代码合并

This commit is contained in:
2023-02-21 19:05:20 +08:00
parent 7e530fb008
commit b644c8233e
6 changed files with 150 additions and 94 deletions

View File

@@ -48,6 +48,7 @@ public class StructivtServiceImpl implements StructivtService {
String material = MapUtil.getStr(whereJson, "material"); String material = MapUtil.getStr(whereJson, "material");
String struct = MapUtil.getStr(whereJson, "struct"); String struct = MapUtil.getStr(whereJson, "struct");
String stor_id = MapUtil.getStr(whereJson, "stor_id"); String stor_id = MapUtil.getStr(whereJson, "stor_id");
String sect_id = MapUtil.getStr(whereJson, "sect_id");
String pcsn = MapUtil.getStr(whereJson, "pcsn"); String pcsn = MapUtil.getStr(whereJson, "pcsn");
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn"); String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
String package_box_sn = MapUtil.getStr(whereJson, "package_box_sn"); String package_box_sn = MapUtil.getStr(whereJson, "package_box_sn");
@@ -55,6 +56,7 @@ public class StructivtServiceImpl implements StructivtService {
JSONObject map = new JSONObject(); JSONObject map = new JSONObject();
map.put("flag", "1"); map.put("flag", "1");
map.put("stor_id", stor_id); map.put("stor_id", stor_id);
map.put("sect_id", sect_id);
if (StrUtil.isNotEmpty(material)) { if (StrUtil.isNotEmpty(material)) {
map.put("material", "%" + material + "%"); map.put("material", "%" + material + "%");
} }

View File

@@ -17,6 +17,7 @@
输入.struct TYPEAS s_string 输入.struct TYPEAS s_string
输入.material TYPEAS s_string 输入.material TYPEAS s_string
输入.stor_id TYPEAS s_string 输入.stor_id TYPEAS s_string
输入.sect_id TYPEAS s_string
输入.pcsn TYPEAS s_string 输入.pcsn TYPEAS s_string
输入.sap_pcsn TYPEAS s_string 输入.sap_pcsn TYPEAS s_string
输入.sale_order_name TYPEAS s_string 输入.sale_order_name TYPEAS s_string
@@ -95,6 +96,10 @@
attr.stor_id = 输入.stor_id attr.stor_id = 输入.stor_id
ENDOPTION ENDOPTION
OPTION 输入.sect_id <> ""
attr.sect_id = 输入.sect_id
ENDOPTION
OPTION 输入.package_box_sn <> "" OPTION 输入.package_box_sn <> ""
sub.package_box_sn like 输入.package_box_sn sub.package_box_sn like 输入.package_box_sn
ENDOPTION ENDOPTION

View File

@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@@ -958,85 +959,121 @@ public class MesToLmsServiceImpl implements MesToLmsService {
String SaleOrderItem = param.getString("SaleOrderItem"); String SaleOrderItem = param.getString("SaleOrderItem");
String CustomerName = param.getString("CustomerName"); String CustomerName = param.getString("CustomerName");
String DemandDate = param.getString("DemandDate"); String DemandDate = param.getString("DemandDate");
double total_qty = 0;
double detail_count = 0;
String changeinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
if (ObjectUtil.isEmpty(rows) || rows.size() == 0) { if (ObjectUtil.isEmpty(rows) || rows.size() == 0) {
throw new BadRequestException("item长度不能为0"); throw new BadRequestException("item长度不能为0");
} }
// 定义set集合储存仓库
HashSet<String> storSet = new HashSet<>();
for (int i = 0; i < rows.size(); i++) { for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i); JSONObject json = rows.getJSONObject(i);
String PackageBoxSN = row.getString("PackageBoxSN"); String PackageBoxSN = json.getString("PackageBoxSN");
String isRePrintPackageBoxLabel = row.getString("isRePrintPackageBoxLabel");
String isUnPackBox = row.getString("isUnPackBox"); // 查询此木箱在哪个仓库
String UpdatedDateOfProduction = row.getString("UpdatedDateOfProduction"); JSONObject jsonBox = WQLObject.getWQLObject("st_ivt_structattr")
//查询该木箱内子卷数量 .query("storagevehicle_code = '" + PackageBoxSN + "' and is_delete = '0' and is_used = '1' and lock_type = '1'").uniqueResult(0);
JSONArray container_rows = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + PackageBoxSN + "'").getResultJSONArray(0);
for (int j = 0; j < container_rows.size(); j++) { if (ObjectUtil.isEmpty(jsonBox)) {
JSONObject container_row = container_rows.getJSONObject(j); throw new BadRequestException("此木箱不在库内:"+PackageBoxSN);
JSONObject change_jo = new JSONObject();
change_jo.put("changeinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
change_jo.put("changeinv_id", changeinv_id);
change_jo.put("seq_no", detail_count + 1);
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + container_row.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo))
throw new BadRequestException("物料不存在:" + container_row.getString("product_name"));
change_jo.put("material_id", mater_jo.getString("material_id"));
change_jo.put("pcsn", container_row.getString("container_name"));
change_jo.put("package_box_sn", container_row.getString("package_box_sn"));
change_jo.put("mfg_order_name", SaleOrderItem);
change_jo.put("demand_date", DemandDate);
change_jo.put("customer_name", CustomerName);
//查询对应的客户
JSONObject customer_jo = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + CustomerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(customer_jo)) throw new BadRequestException("客户不存在:" + CustomerName);
change_jo.put("customer_description", customer_jo.getString("cust_name"));
change_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel);
change_jo.put("isUnPackBox", isUnPackBox);
change_jo.put("UpdatedDateOfProduction", UpdatedDateOfProduction);
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(unit))
throw new BadRequestException("计量单位不存在:" + mater_jo.getString("base_unit_id"));
change_jo.put("qty_unit_id", mater_jo.getString("base_unit_id"));
change_jo.put("qty_unit_name", unit.getString("unit_name"));
change_jo.put("qty", container_row.getString("net_weight"));
WQLObject.getWQLObject("ST_IVT_StructIvtChangeDtl").insert(change_jo);
total_qty += container_row.getDoubleValue("net_weight");
detail_count += 1;
} }
storSet.add(jsonBox.getString("stor_code"));
} }
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject mst_jo = new JSONObject(); // 根据仓库生成多个库存变更单据
mst_jo.put("changeinv_id", changeinv_id); for (String stor_code : storSet) {
mst_jo.put("bill_code", CodeUtil.getNewCode("CHANGE_CODE")); double total_qty = 0;
mst_jo.put("buss_type", "2001"); double detail_count = 0;
mst_jo.put("bill_type", "2001"); String changeinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
mst_jo.put("biz_date", DateUtil.today());
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(stor)) throw new BadRequestException("仓库不存在!");
mst_jo.put("stor_id", stor.getString("stor_id"));
mst_jo.put("stor_code", stor.getString("stor_code"));
mst_jo.put("stor_name", stor.getString("stor_name"));
mst_jo.put("total_qty", total_qty);
mst_jo.put("detail_count", detail_count);
mst_jo.put("bill_status", "10");
mst_jo.put("create_mode", "03");
mst_jo.put("input_optid", currentUserId + "");
mst_jo.put("input_optname", nickName);
mst_jo.put("input_time", now);
mst_jo.put("update_optid", currentUserId + "");
mst_jo.put("update_optname", nickName);
mst_jo.put("update_time", now);
mst_jo.put("is_delete", "0");
mst_jo.put("is_upload", "0");
Long deptId = SecurityUtils.getDeptId();
mst_jo.put("sysdeptid", deptId + "");
mst_jo.put("syscompanyid", deptId + "");
WQLObject.getWQLObject("ST_IVT_StructIvtChange").insert(mst_jo);
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_code = '" + stor_code + "'").uniqueResult(0);
JSONArray rowsDtl = new JSONArray();
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
String PackageBoxSN = row.getString("PackageBoxSN");
JSONObject jsonBox = WQLObject.getWQLObject("st_ivt_structattr")
.query("storagevehicle_code = '" + PackageBoxSN + "' and is_delete = '0' and is_used = '1' and lock_type = '1'").uniqueResult(0);
if (StrUtil.equals(jsonBox.getString("stor_code"),stor_code)) {
rowsDtl.add(row);
}
}
// 插入库存变更主表明细表
for (int i = 0; i < rowsDtl.size(); i++) {
JSONObject row = rowsDtl.getJSONObject(i);
String PackageBoxSN = row.getString("PackageBoxSN");
String isRePrintPackageBoxLabel = row.getString("isRePrintPackageBoxLabel");
String isUnPackBox = row.getString("isUnPackBox");
String UpdatedDateOfProduction = row.getString("UpdatedDateOfProduction");
//查询该木箱内子卷数量
JSONArray container_rows = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + PackageBoxSN + "'").getResultJSONArray(0);
for (int j = 0; j < container_rows.size(); j++) {
JSONObject container_row = container_rows.getJSONObject(j);
JSONObject change_jo = new JSONObject();
change_jo.put("changeinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
change_jo.put("changeinv_id", changeinv_id);
change_jo.put("seq_no", detail_count + 1);
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + container_row.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo))
throw new BadRequestException("物料不存在:" + container_row.getString("product_name"));
change_jo.put("material_id", mater_jo.getString("material_id"));
change_jo.put("pcsn", container_row.getString("container_name"));
change_jo.put("package_box_sn", container_row.getString("package_box_sn"));
change_jo.put("mfg_order_name", SaleOrderItem);
change_jo.put("demand_date", DemandDate);
change_jo.put("customer_name", CustomerName);
//查询对应的客户
JSONObject customer_jo = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + CustomerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(customer_jo)) throw new BadRequestException("客户不存在:" + CustomerName);
change_jo.put("customer_description", customer_jo.getString("cust_name"));
change_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel);
change_jo.put("isUnPackBox", isUnPackBox);
change_jo.put("UpdatedDateOfProduction", UpdatedDateOfProduction);
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(unit))
throw new BadRequestException("计量单位不存在:" + mater_jo.getString("base_unit_id"));
change_jo.put("qty_unit_id", mater_jo.getString("base_unit_id"));
change_jo.put("qty_unit_name", unit.getString("unit_name"));
change_jo.put("qty", container_row.getString("net_weight"));
WQLObject.getWQLObject("ST_IVT_StructIvtChangeDtl").insert(change_jo);
total_qty += container_row.getDoubleValue("net_weight");
detail_count += 1;
}
}
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject mst_jo = new JSONObject();
mst_jo.put("changeinv_id", changeinv_id);
mst_jo.put("bill_code", CodeUtil.getNewCode("CHANGE_CODE"));
mst_jo.put("buss_type", "2001");
mst_jo.put("bill_type", "2001");
mst_jo.put("biz_date", DateUtil.today());
mst_jo.put("stor_id", jsonStor.getString("stor_id"));
mst_jo.put("stor_code", jsonStor.getString("stor_code"));
mst_jo.put("stor_name", jsonStor.getString("stor_name"));
mst_jo.put("total_qty", total_qty);
mst_jo.put("detail_count", detail_count);
mst_jo.put("bill_status", "10");
mst_jo.put("create_mode", "03");
mst_jo.put("input_optid", currentUserId + "");
mst_jo.put("input_optname", nickName);
mst_jo.put("input_time", now);
mst_jo.put("update_optid", currentUserId + "");
mst_jo.put("update_optname", nickName);
mst_jo.put("update_time", now);
mst_jo.put("is_delete", "0");
mst_jo.put("is_upload", "0");
Long deptId = SecurityUtils.getDeptId();
mst_jo.put("sysdeptid", deptId + "");
mst_jo.put("syscompanyid", deptId + "");
WQLObject.getWQLObject("ST_IVT_StructIvtChange").insert(mst_jo);
}
result.put("RTYPE", "S"); result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!"); result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1); result.put("RTOAL", 1);

View File

@@ -1,6 +1,7 @@
package org.nl.wms.st.instor.service.impl; package org.nl.wms.st.instor.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@@ -119,10 +120,11 @@ public class ChangeServiceImpl implements ChangeService {
mst_jo.put("buss_type", "2002"); mst_jo.put("buss_type", "2002");
mst_jo.put("bill_type", "2002"); mst_jo.put("bill_type", "2002");
mst_jo.put("biz_date", DateUtil.today()); mst_jo.put("biz_date", DateUtil.today());
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
mst_jo.put("stor_id", stor.getString("stor_id")); // JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
mst_jo.put("stor_code", stor.getString("stor_code")); mst_jo.put("stor_id", MapUtil.getStr(map, "stor_id"));
mst_jo.put("stor_name", stor.getString("stor_name")); mst_jo.put("stor_code", MapUtil.getStr(map, "stor_code"));
mst_jo.put("stor_name", MapUtil.getStr(map, "stor_name"));
mst_jo.put("bill_status", "10"); mst_jo.put("bill_status", "10");
mst_jo.put("create_mode", "01"); mst_jo.put("create_mode", "01");
mst_jo.put("input_optid", currentUserId + ""); mst_jo.put("input_optid", currentUserId + "");

View File

@@ -11,22 +11,16 @@
label-width="90px" label-width="90px"
label-suffix=":" label-suffix=":"
> >
<el-form-item label="仓库"> <el-form-item label="所属库区">
<el-select <el-cascader
v-model="query.stor_id" placeholder="所属库区"
:options="sects"
:props="{ checkStrictly: true }"
clearable clearable
filterable
size="mini"
class="filter-item" class="filter-item"
style="width: 200px;" style="width: 200px;"
@change="hand" @change="sectQueryChange"
> />
<el-option
v-for="item in storlist"
:label="item.stor_name"
:value="item.stor_id"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="仓位搜索"> <el-form-item label="仓位搜索">
<el-input <el-input
@@ -142,8 +136,6 @@ import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation' import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
import crudPoint from '@/views/wms/sch/point/point'
import crudStorattr from '@/views/wms/basedata/st/stor/storattr'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor' import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
import { download } from '@/api/data' import { download } from '@/api/data'
import { downloadFile } from '@/utils' import { downloadFile } from '@/utils'
@@ -167,7 +159,7 @@ export default {
}, },
data() { data() {
return { return {
storlist: [], sects: [],
permission: { permission: {
}, },
rules: { rules: {
@@ -175,8 +167,8 @@ export default {
} }
}, },
created() { created() {
crudUserStor.getUserStor().then(res => { crudUserStor.getSect({ 'stor_id': '' }).then(res => {
this.storlist = res this.sects = res.content
}) })
}, },
methods: { methods: {
@@ -191,6 +183,21 @@ export default {
hand(value) { hand(value) {
this.crud.toQuery() this.crud.toQuery()
}, },
sectQueryChange(val) {
if (val.length === 1) {
this.query.stor_id = val[0]
this.query.sect_id = ''
}
if (val.length === 0) {
this.query.sect_id = ''
this.query.stor_id = ''
}
if (val.length === 2) {
this.query.stor_id = val[0]
this.query.sect_id = val[1]
}
this.crud.toQuery()
},
downdtl() { downdtl() {
if (this.currentRow !== null) { if (this.currentRow !== null) {
crud.downloadLoading = true crud.downloadLoading = true

View File

@@ -169,9 +169,12 @@
<el-table-column prop="stor_name" label="仓库" :min-width="flexWidth('stor_name',crud.data,'仓库')"/> <el-table-column prop="stor_name" label="仓库" :min-width="flexWidth('stor_name',crud.data,'仓库')"/>
<el-table-column prop="bill_type" :formatter="bill_typeFormat" label="业务类型" :min-width="flexWidth('bill_type',crud.data,'业务类型')"/> <el-table-column prop="bill_type" :formatter="bill_typeFormat" label="业务类型" :min-width="flexWidth('bill_type',crud.data,'业务类型')"/>
<el-table-column prop="biz_date" label="业务日期" :min-width="flexWidth('biz_date',crud.data,'业务日期')"/> <el-table-column prop="biz_date" label="业务日期" :min-width="flexWidth('biz_date',crud.data,'业务日期')"/>
<el-table-column :formatter="create_modeFormat" prop="create_mode" label="生成方式" :min-width="flexWidth('create_mode',crud.data,'生成方式')"/> <el-table-column :formatter="create_modeFormat" prop="create_mode" label="生成方式" width="135px"/>
<el-table-column label="明细数" prop="detail_count" :min-width="flexWidth('detail_count',crud.data,'明细数')"/> <el-table-column label="明细数" prop="detail_count" :min-width="flexWidth('detail_count',crud.data,'明细数')"/>
<el-table-column prop="input_optname" label="创建人" :min-width="flexWidth('input_optname',crud.data,'创建人')"/>
<el-table-column prop="input_time" label="创建日期" :min-width="flexWidth('input_time',crud.data,'创建日期')"/> <el-table-column prop="input_time" label="创建日期" :min-width="flexWidth('input_time',crud.data,'创建日期')"/>
<el-table-column prop="confirm_optname" label="变更人" :min-width="flexWidth('confirm_optname',crud.data,'变更人')"/>
<el-table-column prop="confirm_time" label="变更日期" :min-width="flexWidth('confirm_time',crud.data,'变更日期')"/>
</el-table> </el-table>
<!--分页组件--> <!--分页组件-->
<pagination /> <pagination />