opt:代码优化
This commit is contained in:
@@ -45,4 +45,11 @@ public class ErpToWmsController {
|
||||
public ResponseEntity<Object> sendTask(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(erpToWmsService.sendTask(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/groupplate")
|
||||
@Log("下发组盘信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendGroupplate(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(erpToWmsService.sendGroupplate(whereJson),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +43,24 @@ public interface ErpToWmsService {
|
||||
* @return ErpResponse
|
||||
*/
|
||||
ErpResponse sendTask(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 下发出库单据
|
||||
* @param whereJson: {
|
||||
* stor_code:仓库编码
|
||||
* inv_code:单据号(可为空)
|
||||
* task_type :业务类型(可为空)
|
||||
* data : [
|
||||
* {
|
||||
* mater_code:物料编码
|
||||
* batch_no:批次号(可为空)
|
||||
* quantity:数量
|
||||
* unit_code:计量单位
|
||||
* unit_name:计量单位名称
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* @return ErpResponse
|
||||
*/
|
||||
ErpResponse sendGroupplate(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -131,4 +131,63 @@ public class ErpToWmsServiceImpl implements ErpToWmsService {
|
||||
log.info("sendTask下发出库任务接口输出参数为:-------------------" + ErpResponse.requestOk().toString());
|
||||
return ErpResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErpResponse sendGroupplate(JSONObject whereJson) {
|
||||
log.info("sendTask下发出库任务接口输入参数为:-------------------" + whereJson.toString());
|
||||
// 组织主表数据
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
jsonMst.put("biz_date", DateUtil.now());
|
||||
jsonMst.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
jsonMst.put("source_id", whereJson.getString("inv_code"));
|
||||
jsonMst.put("source_type", whereJson.getString("task_type"));
|
||||
jsonMst.put("bill_type", whereJson.getString("task_type"));
|
||||
jsonMst.put("user", "erp");
|
||||
// 查询仓库
|
||||
BsrealStorattr storDao = iBsrealStorattrService.findByCode(whereJson.getString("stor_code"));
|
||||
if (storDao == null) {
|
||||
throw new BadRequestException("仓库不存在");
|
||||
}
|
||||
jsonMst.put("stor_id", storDao.getStor_id());
|
||||
// 组织明细
|
||||
List<JSONObject> dataList = whereJson.getJSONArray("data").toJavaList(JSONObject.class);
|
||||
// 查询所有物料
|
||||
List<MdMeMaterialbase> materDaoList = iMdMeMaterialbaseService.list(
|
||||
new QueryWrapper<MdMeMaterialbase>().lambda()
|
||||
.in(MdMeMaterialbase::getMaterial_code, dataList.stream()
|
||||
.map(row -> row.getString("mater_code"))
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
);
|
||||
// 查询所有计量单位
|
||||
List<MdPbMeasureunit> unitDaoList = iMdPbMeasureunitService.list(
|
||||
new QueryWrapper<MdPbMeasureunit>().lambda()
|
||||
.in(MdPbMeasureunit::getUnit_code, dataList.stream()
|
||||
.map(row -> row.getString("unit_code"))
|
||||
.collect(Collectors.toList()))
|
||||
);
|
||||
// 明细集合
|
||||
JSONArray dtlArr = new JSONArray();
|
||||
for (JSONObject json : dataList) {
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
MdMeMaterialbase materDao = materDaoList.stream()
|
||||
.filter(row -> row.getMaterial_code().equals(json.getString("mater_code")))
|
||||
.findFirst().orElse(null);
|
||||
jsonDtl.put("material_id", materDao.getMaterial_id());
|
||||
jsonDtl.put("pcsn", json.getString("batch_no"));
|
||||
MdPbMeasureunit unitDao = unitDaoList.stream()
|
||||
.filter(row -> row.getUnit_code().equals(json.getString("unit_code")))
|
||||
.findFirst().orElse(null);
|
||||
jsonDtl.put("qty_unit_id", unitDao.getMeasure_unit_id());
|
||||
jsonDtl.put("qty_unit_name", unitDao.getUnit_name());
|
||||
jsonDtl.put("qty", json.getString("quantity"));
|
||||
dtlArr.add(jsonDtl);
|
||||
}
|
||||
jsonMst.put("tableData",dtlArr);
|
||||
// 调用出库单新增服务
|
||||
iOutBillService.insertDtl(jsonMst);
|
||||
|
||||
log.info("sendTask下发出库任务接口输出参数为:-------------------" + ErpResponse.requestOk().toString());
|
||||
return ErpResponse.requestOk();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,15 @@
|
||||
storagevehicle_code,
|
||||
gp.material_id,pcsn,
|
||||
qty_unit_id,
|
||||
qty_unit_name,qty,frozen_qty,remark,
|
||||
status,ext_code,ext_type,
|
||||
mater.material_name,mater.material_spec,mater.material_code
|
||||
qty_unit_name,qty,
|
||||
frozen_qty,remark,
|
||||
status,ext_code,
|
||||
ext_type,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
mater.material_code,
|
||||
gp.ext_code,
|
||||
gp.ext_type
|
||||
FROM md_pb_groupplate gp
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = gp.material_id
|
||||
<where>
|
||||
|
||||
@@ -90,15 +90,14 @@
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import CRUD, { header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
|
||||
|
||||
export default {
|
||||
name: 'StructDiv',
|
||||
components: { crudOperation, rrOperation, pagination },
|
||||
components: { rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '库存物料',
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
<el-table-column width="200" prop="pcsn" label="批次号" />
|
||||
<el-table-column show-overflow-tooltip width="170" prop="qty" label="数量" />
|
||||
<el-table-column show-overflow-tooltip width="170" prop="qty_unit_name" label="计量单位名称" />
|
||||
<el-table-column prop="ext_code" label="来源单号" :min-width="flexWidth('ext_code',crud.data,'来源单号')" />
|
||||
<el-table-column prop="ext_type" label="来源单据类型" :min-width="flexWidth('ext_type',crud.data,'来源单据类型')" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="载具明细"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1000px"
|
||||
@close="close"
|
||||
>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table2"
|
||||
:data="this.bucketParam"
|
||||
style="width: 100%;"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
>
|
||||
<el-table-column prop="bucketunique" label="桶号" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="label" label="桶类别" />
|
||||
<el-table-column prop="material_code" label="物料编码" width="120px" />
|
||||
<el-table-column prop="material_name" label="物料名称" min-width="120" />
|
||||
<el-table-column prop="pcsn" label="批次" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="storage_qty" label="数量">
|
||||
<template slot-scope="scope">
|
||||
{{ fun(scope.row.storage_qty) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="qty_unit_name" label="单位" />
|
||||
<el-table-column prop="quality_scode" :formatter="qualityFormat" label="品质类型" />
|
||||
<el-table-column prop="ivt_level" :formatter="ivtFormat" label="库存等级" />
|
||||
<el-table-column prop="is_active" :formatter="activeFormat" label="是否可用" />
|
||||
<el-table-column prop="storagevehicle_code" label="载具号" />
|
||||
<el-table-column prop="record_order" label="顺序号" />
|
||||
<el-table-column prop="bag_qty" label="袋数" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
export default {
|
||||
name: 'BucketDtlDiv',
|
||||
components: { crudOperation, pagination },
|
||||
mixins: [crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
bucketParam: {
|
||||
type: Array,
|
||||
default: () => { return [] }
|
||||
}
|
||||
},
|
||||
dicts: ['MD_BUCKET_TYPE', 'bucket_status', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'IS_OR_NOT'],
|
||||
data() {
|
||||
return {
|
||||
sects: [],
|
||||
classes: [],
|
||||
dialogVisible: false,
|
||||
checkrow: {},
|
||||
rows: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fun(val) {
|
||||
return Number(val).toFixed(3)
|
||||
},
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
handleSelectionChange(val, row) {
|
||||
if (val.length > 1) {
|
||||
this.$refs.table.clearSelection()
|
||||
this.$refs.table.toggleRowSelection(val.pop())
|
||||
} else {
|
||||
this.checkrow = row
|
||||
}
|
||||
},
|
||||
onSelectAll() {
|
||||
this.$refs.table.clearSelection()
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
qualityFormat(row, column) {
|
||||
return this.dict.label.ST_QUALITY_SCODE[row.quality_scode]
|
||||
},
|
||||
ivtFormat(row, column) {
|
||||
return this.dict.label.ST_IVT_LEVEL[row.ivt_level]
|
||||
},
|
||||
activeFormat(row, column) {
|
||||
return this.dict.label.IS_OR_NOT[row.is_active]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
<!-- <el-table-column prop="sap_pcsn" label="SAP批次号" width="150" align="center" />-->
|
||||
<el-table-column prop="plan_qty" :formatter="crud.formatNum3" label="重量" align="center" />
|
||||
<el-table-column prop="qty_unit_name" label="单位" align="center" />
|
||||
<el-table-column prop="source_bill_type" label="源单类型" align="center" width="130px" :formatter="invtypeFormat" />
|
||||
<el-table-column prop="source_bill_type" label="源单类型" align="center" width="130px" />
|
||||
<el-table-column prop="source_bill_code" label="源单号" align="center" width="130px" />
|
||||
<el-table-column show-overflow-tooltip prop="remark" label="明细备注" align="center" />
|
||||
</el-table>
|
||||
|
||||
@@ -218,7 +218,6 @@ import DateRangePicker from '@/components/DateRangePicker/index'
|
||||
import AddDialog from '@/views/wms/st/inbill/AddDialog'
|
||||
import DivDialog from '@/views/wms/st/inbill/DivDialog'
|
||||
import ViewDialog from '@/views/wms/st/inbill/ViewDialog'
|
||||
// import TaskDialog from '@/views/wms/st/inbill/TaskDialog'
|
||||
import { mapGetters } from 'vuex'
|
||||
import crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user