opt:提交合单功能
This commit is contained in:
@@ -75,6 +75,7 @@
|
||||
INNER JOIN md_me_materialbase material ON material.material_code = form.material_code
|
||||
<where>
|
||||
form.status = '10'
|
||||
and form.is_merge = '0'
|
||||
and form.form_type = '1001'
|
||||
AND form.is_finish = '0'
|
||||
<if test="param.stor_id != null and param.stor_id != ''">
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ErpToWmsController {
|
||||
return new ResponseEntity<>(erpToWmsService.erpQueryIvt(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/groupplate")
|
||||
@PostMapping("/groupinfo")
|
||||
@Log("下发组盘信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendGroupplate(@RequestBody JSONObject whereJson) {
|
||||
|
||||
@@ -86,6 +86,18 @@ public class ErpToWmsServiceImpl implements ErpToWmsService {
|
||||
|
||||
@Override
|
||||
public ErpResponse sendGroupplate(JSONObject whereJson) {
|
||||
/**
|
||||
* {
|
||||
* "order_code": "3000000056",
|
||||
* "order_type": "03",
|
||||
* "pallet_sn": "zp0000000003",
|
||||
* "mater_frame": "m01",
|
||||
* "mater_code": "0345h-fg0001",
|
||||
* "mater_name": "36μm电镀金刚石切割线",
|
||||
* "unit_code": "件",
|
||||
* "qty": "120.00"
|
||||
* }
|
||||
*/
|
||||
log.info("sendGroupplate下发组盘接口输入参数为:-------------------" + whereJson.toString());
|
||||
// 查询仓库
|
||||
BsrealStorattr storDao = iBsrealStorattrService.findByCode("GW");
|
||||
@@ -119,37 +131,37 @@ public class ErpToWmsServiceImpl implements ErpToWmsService {
|
||||
.filter(row -> row.getMaterial_code().equals(json.getString("mater_code")))
|
||||
.findFirst().orElse(null);
|
||||
jsonDtl.setId(IdUtil.getStringId());
|
||||
jsonDtl.setCode(json.getString("ext_code"));
|
||||
jsonDtl.setCode(json.getString("order_code"));
|
||||
jsonDtl.setStatus(IOSEnum.BILL_STATUS.code("生成"));
|
||||
jsonDtl.setStor_id(storDao.getStor_id());
|
||||
jsonDtl.setStor_name(storDao.getStor_name());
|
||||
jsonDtl.setForm_type(json.getString("ext_type"));
|
||||
jsonDtl.setForm_type(json.getString("order_type"));
|
||||
jsonDtl.setSource_form_date(DateUtil.today());
|
||||
jsonDtl.setMaterial_code(json.getString("mater_code"));
|
||||
jsonDtl.setMaterial_id(materDao.getMaterial_id());
|
||||
jsonDtl.setQty(BigDecimal.valueOf(json.getDoubleValue("quantity")));
|
||||
jsonDtl.setPlan_qty(BigDecimal.valueOf(json.getDoubleValue("quantity")));
|
||||
jsonDtl.setQty(BigDecimal.valueOf(json.getDoubleValue("qty")));
|
||||
jsonDtl.setPlan_qty(BigDecimal.valueOf(json.getDoubleValue("qty")));
|
||||
MdPbMeasureunit unitDao = unitDaoList.stream()
|
||||
.filter(row -> row.getUnit_code().equals(json.getString("unit_code")))
|
||||
.findFirst().orElse(null);
|
||||
jsonDtl.setUnit_id(unitDao.getMeasure_unit_id());
|
||||
jsonDtl.setUnit_name(unitDao.getUnit_name());
|
||||
jsonDtl.setVehicle_code(json.getString("vehicle_code"));
|
||||
jsonDtl.setVehicle_code2(json.getString("vehicle_code2"));
|
||||
jsonDtl.setVehicle_code(json.getString("pallet_sn"));
|
||||
jsonDtl.setVehicle_code2(json.getString("mater_frame"));
|
||||
jsonDtl.setCreate_name("ERP");
|
||||
jsonDtl.setCreate_time(DateUtil.now());
|
||||
dtlArr.add(jsonDtl);
|
||||
|
||||
GroupPlate plate = new GroupPlate();
|
||||
plate.setGroup_id(IdUtil.getStringId());
|
||||
plate.setStoragevehicle_code(json.getString("vehicle_code"));
|
||||
plate.setStoragevehicle_code(json.getString("pallet_sn"));
|
||||
plate.setMaterial_id(materDao.getMaterial_id());
|
||||
plate.setQty_unit_id(unitDao.getMeasure_unit_id());
|
||||
plate.setQty_unit_name(unitDao.getUnit_name());
|
||||
plate.setQty(BigDecimal.valueOf(json.getDoubleValue("quantity")));
|
||||
plate.setQty(BigDecimal.valueOf(json.getDoubleValue("qty")));
|
||||
plate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("生成"));
|
||||
plate.setExt_code(json.getString("ext_code"));
|
||||
plate.setExt_type(json.getString("ext_type"));
|
||||
plate.setExt_code(json.getString("order_code"));
|
||||
plate.setExt_type(json.getString("order_type"));
|
||||
plate.setCreate_name("ERP");
|
||||
plate.setCreate_time(DateUtil.now());
|
||||
plates.add(plate);
|
||||
|
||||
@@ -81,11 +81,14 @@ public class PmFormDataController {
|
||||
|
||||
@GetMapping("/getSonFormData/{id}")
|
||||
public ResponseEntity<Object> getSonDtlFormData(@PathVariable String id) {
|
||||
//参数判读,参数解析,调用参数入库
|
||||
//Page<BmFormStruc> page = iBmFormStrucService.page(pageQuery.build(), query.build());
|
||||
return new ResponseEntity<>(iPmFormDataService.getSonDtlFormData(id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getdtl/{id}")
|
||||
public ResponseEntity<Object> getdtl(@PathVariable String id) {
|
||||
return new ResponseEntity<>(iPmFormDataService.getdtl(id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/confirmStatus")
|
||||
@SaIgnore
|
||||
@@ -109,6 +112,22 @@ public class PmFormDataController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/tomerge")
|
||||
@SaIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> tomerge(@RequestBody JSONArray rows) {
|
||||
iPmFormDataService.tomerge(rows);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/dismerge")
|
||||
@SaIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> dismerge(@RequestBody JSONArray rows) {
|
||||
iPmFormDataService.dismerge(rows);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/sync/{type}")
|
||||
@Log("单据同步")
|
||||
public ResponseEntity<Object> sync(@RequestParam String type, String formDtl) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.pm_manage.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -38,6 +39,10 @@ public interface IPmFormDataService extends IService<PmFormData> {
|
||||
*/
|
||||
void update(PmFormDataParam params);
|
||||
|
||||
void tomerge(JSONArray rows);
|
||||
|
||||
void dismerge(JSONArray rows);
|
||||
|
||||
|
||||
List<PmFormData> getByType(String from_type);
|
||||
|
||||
@@ -52,6 +57,8 @@ public interface IPmFormDataService extends IService<PmFormData> {
|
||||
*/
|
||||
Object getSonDtlFormData(String id);
|
||||
|
||||
List<PmFormData> getdtl(String parent_id);
|
||||
|
||||
void dynamicSql(String sql);
|
||||
|
||||
List<PmFormData> getByParentId(String...parent_id);
|
||||
|
||||
@@ -16,12 +16,11 @@ import java.math.BigDecimal;
|
||||
* @since 2025-06-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("pm_form_data")
|
||||
public class PmFormData extends Model<PmFormData> {
|
||||
public class PmFormData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7739291296662381393L;
|
||||
//@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
|
||||
/**
|
||||
@@ -159,16 +158,17 @@ public class PmFormData extends Model<PmFormData> {
|
||||
*/
|
||||
private Integer is_finish;
|
||||
|
||||
/**
|
||||
* 是否合单
|
||||
*/
|
||||
private String is_merge;
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
* 源单字符串集
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
private String merge_codes;
|
||||
|
||||
private String new_merge_flag;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ public class PmFormDataDto implements Serializable {
|
||||
* 源单单据日期
|
||||
*/
|
||||
private String source_form_date;
|
||||
/**
|
||||
* 物料code
|
||||
*/
|
||||
private String material_id;
|
||||
/**
|
||||
* 物料code
|
||||
*/
|
||||
@@ -133,6 +137,17 @@ public class PmFormDataDto implements Serializable {
|
||||
* 是否完结
|
||||
*/
|
||||
private Integer is_finish;
|
||||
/**
|
||||
* 是否合单
|
||||
*/
|
||||
private String is_merge;
|
||||
|
||||
/**
|
||||
* 源单字符串集
|
||||
*/
|
||||
private String merge_codes;
|
||||
|
||||
private String new_merge_flag;
|
||||
|
||||
/**
|
||||
* 关联上级表单id
|
||||
|
||||
@@ -2,8 +2,12 @@ package org.nl.wms.pm_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -27,6 +31,7 @@ import org.nl.wms.pm_manage.service.dto.PmFormDataDto;
|
||||
import org.nl.wms.pm_manage.service.dto.PmFormDataParam;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.nl.wms.pm_manage.service.IPmFormDataService;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -194,6 +199,17 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
||||
return this.baseMapper.queryTree(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmFormData> getdtl(String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
throw new BadRequestException("请求参数不能为空");
|
||||
}
|
||||
PmFormData form = pmFormDataMapper.selectById(id);
|
||||
String[] codes = form.getMerge_codes().split(",");
|
||||
|
||||
return this.list(new QueryWrapper<PmFormData>().in("code", codes));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@@ -209,6 +225,61 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void tomerge(JSONArray rows){
|
||||
BigDecimal sum_qty = BigDecimal.ZERO;
|
||||
String codes = "";
|
||||
String h_code = "";
|
||||
for(int i=0;i<rows.size();i++){
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
PmFormData form = pmFormDataMapper.selectById(jo.getString("id"));
|
||||
if("1".equals(form.getIs_merge())){
|
||||
throw new BadRequestException("当前单据已合单,不允许再次提交:"+form.getCode());
|
||||
}
|
||||
if("1".equals(form.getNew_merge_flag())){
|
||||
throw new BadRequestException("当前单据为合单后新单据,不允许再次提交:"+form.getCode());
|
||||
}
|
||||
if(i==0){
|
||||
codes = form.getCode();
|
||||
h_code= "H-"+form.getCode();
|
||||
}else{
|
||||
codes = codes+","+form.getCode();
|
||||
}
|
||||
sum_qty = sum_qty.add(form.getQty());
|
||||
form.setIs_merge("1");
|
||||
pmFormDataMapper.updateById(form);
|
||||
if(i==(rows.size()-1)){
|
||||
form.setId(IdUtil.getStringId());
|
||||
form.setQty(sum_qty);
|
||||
form.setCode(h_code);
|
||||
form.setNew_merge_flag("1");
|
||||
form.setMerge_codes(codes);
|
||||
form.setIs_merge("0");
|
||||
pmFormDataMapper.insert(form);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void dismerge(JSONArray rows){
|
||||
for(int i=0;i<rows.size();i++){
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
PmFormData form = pmFormDataMapper.selectById(jo.getString("id"));
|
||||
if(!"1".equals(form.getNew_merge_flag())){
|
||||
throw new BadRequestException("当前单据为非合单新单据,不允许提交:"+form.getCode());
|
||||
}
|
||||
String[] codes = form.getMerge_codes().split(",");
|
||||
|
||||
pmFormDataMapper.update(null,new UpdateWrapper<PmFormData>()
|
||||
.set("is_merge","0")
|
||||
.in("code",codes)
|
||||
);
|
||||
pmFormDataMapper.deleteById(form.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmFormData> getByParentId(String[] parent_id) {
|
||||
Assert.notNull(parent_id, "请求参数不能为空");
|
||||
|
||||
175
nladmin-ui/src/views/wms/pm_manage/form_data2/ViewDialog.vue
Normal file
175
nladmin-ui/src/views/wms/pm_manage/form_data2/ViewDialog.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<!--suppress ALL -->
|
||||
<template>
|
||||
<el-dialog
|
||||
append-to-body
|
||||
title="单据详情"
|
||||
:visible.sync="dialogVisible"
|
||||
fullscreen
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true"
|
||||
:model="form" size="mini" label-width="100px" label-suffix=":">
|
||||
<el-form-item label="单据编号" prop="code">
|
||||
<el-input v-model="form.code" disabled placeholder="系统生成" style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据类型" prop="form_type">
|
||||
<el-input v-model="form.form_type" disabled style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据日期" prop="source_form_date">
|
||||
<el-input v-model="form.source_form_date" disabled style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料数量" prop="qty">
|
||||
<el-input v-model="form.qty" disabled style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据状态" prop="status">
|
||||
<el-select
|
||||
v-model="form.status"
|
||||
disabled
|
||||
size="mini"
|
||||
placeholder="单据状态"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.io_bill_status"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="create_time">
|
||||
<el-input v-model="form.create_time" disabled clearable style="width: 210px"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="crud-opts2">
|
||||
<span class="role-span2">单据明细</span>
|
||||
</div>
|
||||
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableDtl"
|
||||
style="width: 100%;"
|
||||
max-height="300"
|
||||
size="mini"
|
||||
border
|
||||
:highlight-current-row="true"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column prop="code" label="单据编码" min-width="140" />
|
||||
<el-table-column prop="is_merge" label="是否已合单" :formatter="merge_Format" show-overflow-tooltip />
|
||||
<el-table-column show-overflow-tooltip prop="stor_name" min-width="120" label="仓库" />
|
||||
<el-table-column prop="material_code" label="物料编码" show-overflow-tooltip :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="qty" label="数量" show-overflow-tooltip />
|
||||
<el-table-column prop="assign_qty" label="出库已分配数量" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="unit_name" label="单位" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="source_form_date" label="单据日期" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="status" label="单据状态" show-overflow-tooltip :formatter="status_Format" width="120" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {crud} from '@crud/crud'
|
||||
import crudFormData, {getSonFormData} from './formData'
|
||||
|
||||
export default {
|
||||
name: 'ViewDialog',
|
||||
mixins: [crud()],
|
||||
dicts: ['base_data', 'ST_INV_IN_TYPE', 'io_bill_status', 'IS_OR_NOT'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
rowmst: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableDtl: [],
|
||||
form: {},
|
||||
formStatus: [
|
||||
{
|
||||
value: '10',
|
||||
label: '生成'
|
||||
},
|
||||
{
|
||||
value: '20',
|
||||
label: '执行中'
|
||||
},
|
||||
{
|
||||
value: '99',
|
||||
label: '完成'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
rowmst: {
|
||||
handler(newValue) {
|
||||
this.form = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
|
||||
},
|
||||
setForm(row) {
|
||||
this.dialogVisible = true
|
||||
this.form = row
|
||||
this.queryTableDtl(row.id)
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
status_Format(row, column) {
|
||||
return this.dict.label.io_bill_status[row.status]
|
||||
},
|
||||
merge_Format(row, column) {
|
||||
return this.dict.label.IS_OR_NOT[row.is_merge]
|
||||
},
|
||||
queryTableDtl(id) {
|
||||
crudFormData.getdtl(id).then(res => {
|
||||
this.tableDtl = res
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.crud-opts2 {
|
||||
padding: 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .el-dialog__title2 {
|
||||
line-height: 24px;
|
||||
font-size: 20px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.crud-opts2 .role-span2 {
|
||||
padding: 0px 0px 20px 0px;
|
||||
}
|
||||
|
||||
.crud-opts2 {
|
||||
padding: 10px 0px 0px 50px;
|
||||
}
|
||||
|
||||
</style>
|
||||
70
nladmin-ui/src/views/wms/pm_manage/form_data2/formData.js
Normal file
70
nladmin-ui/src/views/wms/pm_manage/form_data2/formData.js
Normal file
@@ -0,0 +1,70 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/pmFormData',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/pmFormData',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/pmFormData',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getFormType() {
|
||||
return request({
|
||||
url: 'api/bmFormStruc/getTypes',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getParentFormTypes() {
|
||||
return request({
|
||||
url: 'api/bmFormStruc/getParentFormTypes',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getSonFormData(id) {
|
||||
return request({
|
||||
url: 'api/pmFormData/getSonFormData/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getdtl(id) {
|
||||
return request({
|
||||
url: 'api/pmFormData/getdtl/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function tomerge(data) {
|
||||
return request({
|
||||
url: '/api/pmFormData/tomerge',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function dismerge(data) {
|
||||
return request({
|
||||
url: '/api/pmFormData/dismerge',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, getParentFormTypes, getSonFormData, dismerge, tomerge, getdtl }
|
||||
264
nladmin-ui/src/views/wms/pm_manage/form_data2/index.vue
Normal file
264
nladmin-ui/src/views/wms/pm_manage/form_data2/index.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="单据日期" prop="analyseData">
|
||||
<el-date-picker
|
||||
v-model="query.datepick"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据编码">
|
||||
<el-input
|
||||
v-model="query.code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="编码"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码">
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
clearable
|
||||
style="width: 250px"
|
||||
size="mini"
|
||||
placeholder="请输入物料编码"
|
||||
prefix-icon="el-icon-search"
|
||||
class="filter-item"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否合单">
|
||||
<el-select
|
||||
v-model="query.is_merge"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.IS_OR_NOT"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据状态">
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="单据状态"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.io_bill_status"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
>
|
||||
导入
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="tomerge"
|
||||
>
|
||||
合并清单
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-minus"
|
||||
@click="dismerge"
|
||||
>
|
||||
取消合并
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
lazy
|
||||
:data="crud.data"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="code" label="单据编码" min-width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-link v-if="scope.row.new_merge_flag === '1'" type="warning" @click="toView(scope.row)">{{
|
||||
scope.row.code
|
||||
}}
|
||||
</el-link>
|
||||
<span v-else>{{ scope.row.code }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_merge" label="是否已合单" :formatter="merge_Format" show-overflow-tooltip />
|
||||
<el-table-column show-overflow-tooltip prop="stor_name" min-width="120" label="仓库" />
|
||||
<el-table-column prop="material_code" label="物料编码" show-overflow-tooltip :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="material_name" label="物料名称" show-overflow-tooltip :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||||
<el-table-column prop="qty" label="数量" show-overflow-tooltip />
|
||||
<el-table-column prop="assign_qty" label="出库已分配数量" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="unit_name" label="单位" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="source_form_date" label="清单日期" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="status" label="单据状态" show-overflow-tooltip :formatter="status_Format" width="120" />
|
||||
<el-table-column prop="merge_codes" label="被合单据" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<ViewDialog ref="viewDialog" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudFormData from './formData'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation.vue'
|
||||
import rrOperation from '@crud/RR.operation.vue'
|
||||
import pagination from '@crud/Pagination.vue'
|
||||
import ViewDialog from './ViewDialog.vue'
|
||||
|
||||
export default {
|
||||
name: 'FormData2',
|
||||
dicts: ['base_data', 'ST_INV_IN_TYPE', 'io_bill_status', 'IS_OR_NOT'],
|
||||
components: { pagination, crudOperation, rrOperation, ViewDialog },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '用料清单管理',
|
||||
url: 'api/pmFormData',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: { ...crudFormData },
|
||||
optShow: {
|
||||
add: false,
|
||||
reset: true
|
||||
},
|
||||
query: {
|
||||
form_type: '1001'
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
rows : [],
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
if (this.query.datepick) {
|
||||
this.query.start_time = this.query.datepick[0]
|
||||
if (this.query.datepick.length > 1) {
|
||||
this.query.end_time = this.query.datepick[1]
|
||||
}
|
||||
} else {
|
||||
this.query.start_time = ''
|
||||
this.query.end_time = ''
|
||||
}
|
||||
},
|
||||
status_Format(row, column) {
|
||||
return this.dict.label.io_bill_status[row.status]
|
||||
},
|
||||
merge_Format(row, column) {
|
||||
return this.dict.label.IS_OR_NOT[row.is_merge]
|
||||
},
|
||||
tomerge() {
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length < 2) {
|
||||
this.crud.notify('最少选择2个单据进行合单', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
const mater = this.rows[0].material_code
|
||||
for (let i = 0; i < this.rows.length; i++) {
|
||||
const now = this.rows[i]
|
||||
if (now.is_merge === '1') {
|
||||
this.crud.notify('不允许提交已合单的单据:' + now.code, CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
if (now.new_merge_flag === '1') {
|
||||
this.crud.notify('不允许提交合新合单的单据:' + now.code, CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
if (now.material_code !== mater) {
|
||||
this.crud.notify('合单的物料必须相同:' + now.material_code, CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
}
|
||||
crudFormData.tomerge(this.rows).then(res => {
|
||||
this.crud.notify('合单成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
dismerge() {
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length < 1) {
|
||||
this.crud.notify('请选择需要取消合单的单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < this.rows.length; i++) {
|
||||
const now = this.rows[i]
|
||||
if (now.new_merge_flag === '0') {
|
||||
this.crud.notify('不允许提交未合单的单据:' + now.code, CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
}
|
||||
crudFormData.dismerge(this.rows).then(res => {
|
||||
this.crud.notify('取消合单成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
toView(row) {
|
||||
if (row !== null) {
|
||||
this.$refs.viewDialog.setForm(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user