This commit is contained in:
2022-12-03 14:03:29 +08:00
parent e35bb630cd
commit 64efeb8da5
3 changed files with 179 additions and 94 deletions

View File

@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
/**
@@ -56,7 +57,7 @@ public class ChangeServiceImpl implements ChangeService {
UserStorServiceImpl userStorService = new UserStorServiceImpl();
String in_stor_id = userStorService.getInStor();
if (ObjectUtil.isNotEmpty(in_stor_id)) map.put("in_stor_id",in_stor_id);
if (ObjectUtil.isNotEmpty(in_stor_id)) map.put("in_stor_id", in_stor_id);
JSONObject jo = WQL.getWO("QST_IVT_CHANGE").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "bill_code desc");
return jo;
@@ -72,6 +73,7 @@ public class ChangeServiceImpl implements ChangeService {
/**
* 通过changeinv_id删除明细
*
* @param changeinv_id
*/
void deleteById(String changeinv_id) {
@@ -153,14 +155,26 @@ public class ChangeServiceImpl implements ChangeService {
double total_qty = 0;
double detail_count = 0;
//定义需要需要插入的库存集合
for (int j = 0; j < rows.size(); j++) {
HashMap row = rows.get(j);
HashMap<String, HashMap> set = new HashMap<>();
for (int i = 0; i < rows.size(); i++) {
HashMap row = rows.get(i);
String package_box_sn = (String) row.get("package_box_sn");
if (set.containsKey(package_box_sn)) {
continue;
} else {
set.put(package_box_sn, row);
}
}
for (String package_box_sn : set.keySet()) {
HashMap row = set.get(package_box_sn);
String SaleOrderItem = (String) row.get("new_sale_order_name");
String DemandDate = (String) row.get("demand_date");
String CustomerName = (String) row.get("new_customer_name");
String isRePrintPackageBoxLabel = (String) row.get("isRePrintPackageBoxLabel");
String isUnPackBox = (String) row.get("isUnPackBox");
String UpdatedDateOfProduction = (String) row.get("date_of_FG_inbound");
String isRePrintPackageBoxLabel = (String) row.get("isreprintpackageboxlabel");
String isUnPackBox = (String) row.get("isunpackbox");
String UpdatedDateOfProduction = (String) row.get("date_of_fg_inbound");
//查询该木箱内子卷数量
JSONArray container_rows = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + row.get("storagevehicle_code") + "'").getResultJSONArray(0);
for (int i = 0; i < container_rows.size(); i++) {
@@ -178,8 +192,8 @@ public class ChangeServiceImpl implements ChangeService {
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);
if (ObjectUtil.isEmpty(customer_jo)) {
throw new BadRequestException("未查询到对应客户编码为:" + CustomerName);
}
change_jo.put("customer_description", customer_jo.getString("cust_name"));
change_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel);
@@ -383,16 +397,16 @@ public class ChangeServiceImpl implements ChangeService {
@Transactional(rollbackFor = Exception.class)
public void update(Map whereJson) {
//主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv");
WQLObject wo_mst = WQLObject.getWQLObject("st_ivt_structivtchange");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
String moveinv_id = (String) whereJson.get("moveinv_id");
String changeinv_id = (String) whereJson.get("changeinv_id");
//查询主表
JSONObject jo_mst = wo_mst.query("moveinv_id='" + moveinv_id + "'").uniqueResult(0);
JSONObject jo_mst = wo_mst.query("changeinv_id='" + changeinv_id + "'").uniqueResult(0);
//调用删除明细,还原库存方法
this.deleteById(moveinv_id + "");
this.deleteById(changeinv_id + "");
//获取明细
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
//调用明细处理方法
@@ -555,38 +569,38 @@ public class ChangeServiceImpl implements ChangeService {
JSONArray ja = wo_dtl.query("changeinv_id='" + changeinv_id + "'").getResultJSONArray(0);
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
HashMap<String,String> map = new HashMap<>();
map.put("sale_order_name",jo.getString("mfg_order_name"));
map.put("customer_name",jo.getString("customer_name"));
map.put("customer_description",jo.getString("customer_description"));
map.put("isRePrintPackageBoxLabel",jo.getString("isreprintpackageboxlabel"));
map.put("isUnPackBox",jo.getString("isunpackbox"));
HashMap<String, String> map = new HashMap<>();
map.put("sale_order_name", jo.getString("mfg_order_name"));
map.put("customer_name", jo.getString("customer_name"));
map.put("customer_description", jo.getString("customer_description"));
map.put("isRePrintPackageBoxLabel", jo.getString("isreprintpackageboxlabel"));
map.put("isUnPackBox", jo.getString("isunpackbox"));
String UpdatedDateOfProduction = jo.getString("updateddateofproduction");
String pcsn = jo.getString("pcsn");
JSONObject old_sub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '"+pcsn+"' AND status = '2'").uniqueResult(0);
old_sub.put("change_type_scode","02");
old_sub.put("change_order_id",jo_mst.getString("changeinv_id"));
old_sub.put("change_order_code",jo_mst.getString("bill_code"));
old_sub.put("create_id",currentUserId);
old_sub.put("create_name",nickName);
old_sub.put("change_time",DateUtil.now());
old_sub.put("workorder_id",IdUtil.getSnowflake(1, 1).nextId() + "");
JSONObject old_sub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '" + pcsn + "' AND status = '2'").uniqueResult(0);
old_sub.put("change_type_scode", "02");
old_sub.put("change_order_id", jo_mst.getString("changeinv_id"));
old_sub.put("change_order_code", jo_mst.getString("bill_code"));
old_sub.put("create_id", currentUserId);
old_sub.put("create_name", nickName);
old_sub.put("change_time", DateUtil.now());
old_sub.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId() + "");
WQLObject.getWQLObject("PDM_BI_SubPackageRelationChangeFlow").insert(old_sub);
if (StrUtil.isNotEmpty(UpdatedDateOfProduction)){
map.put("date_of_FG_inbound",UpdatedDateOfProduction);
if (StrUtil.isNotEmpty(UpdatedDateOfProduction)) {
map.put("date_of_FG_inbound", UpdatedDateOfProduction);
}
WQLObject.getWQLObject("pdm_bi_subpackagerelation").update(map,"container_name = '"+pcsn+"' AND status = '2'");
WQLObject.getWQLObject("pdm_bi_subpackagerelation").update(map, "container_name = '" + pcsn + "' AND status = '2'");
JSONObject new_sub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '"+pcsn+"' AND status = '2'").uniqueResult(0);
new_sub.put("change_type_scode","01");
new_sub.put("change_order_id",jo_mst.getString("changeinv_id"));
new_sub.put("change_order_code",jo_mst.getString("bill_code"));
new_sub.put("create_id",currentUserId);
new_sub.put("create_name",nickName);
new_sub.put("change_time",DateUtil.now());
new_sub.put("workorder_id",IdUtil.getSnowflake(1, 1).nextId() + "");
JSONObject new_sub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '" + pcsn + "' AND status = '2'").uniqueResult(0);
new_sub.put("change_type_scode", "01");
new_sub.put("change_order_id", jo_mst.getString("changeinv_id"));
new_sub.put("change_order_code", jo_mst.getString("bill_code"));
new_sub.put("create_id", currentUserId);
new_sub.put("create_name", nickName);
new_sub.put("change_time", DateUtil.now());
new_sub.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId() + "");
WQLObject.getWQLObject("PDM_BI_SubPackageRelationChangeFlow").insert(new_sub);
}
HashMap<String, String> map_mst = new HashMap<>();

View File

@@ -83,7 +83,7 @@
v-model="query.sale_order_name"
clearable
size="small"
placeholder="sap批次"
placeholder="销售订单"
style="width: 200px;"
class="filter-item"
/>

View File

@@ -10,7 +10,7 @@
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
<span/>
</el-col>
<el-col :span="4">
<span>
@@ -36,11 +36,11 @@
label-width="85px"
label-suffix=":"
>
<el-input v-show="false" v-model="form.stor_code" placeholder="仓库编码" />
<el-input v-show="false" v-model="form.stor_name" placeholder="仓库名称" />
<el-input v-show="false" v-model="form.stor_code" placeholder="仓库编码"/>
<el-input v-show="false" v-model="form.stor_name" placeholder="仓库名称"/>
<el-form-item label="单据号" prop="bill_code">
<label slot="label">单&nbsp;&nbsp;据&nbsp;号:</label>
<el-input v-model="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" />
<el-input v-model="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px"/>
</el-form-item>
<el-form-item label="仓库" prop="stor_id">
<label slot="label">仓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库:</label>
@@ -94,7 +94,7 @@
<el-form-item label="明细数" prop="detail_count">
<label slot="label">明&nbsp;&nbsp;细&nbsp;数:</label>
<el-input v-model="form.detail_count" size="mini" disabled style="width: 210px" />
<el-input v-model="form.detail_count" size="mini" disabled style="width: 210px"/>
</el-form-item>
<el-form-item label="总重量" prop="total_qty">
<label slot="label">总&nbsp;&nbsp;重&nbsp;量:</label>
@@ -134,7 +134,7 @@
<span v-if="crud.status.cu > 0" class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<slot name="left"/>
<el-button
slot="left"
class="filter-item"
@@ -156,72 +156,92 @@
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column key="1" type="index" label="序号" width="50" align="center" />
<el-table-column key="3" prop="material_code" label="物料编码" width="150" align="center" />
<el-table-column key="1" type="index" label="序号" width="50" align="center"/>
<el-table-column key="3" prop="material_code" label="物料编码" width="150" align="center"/>
<el-table-column key="4" prop="material_name" label="物料名称" align="center" min-width="200"/>
<el-table-column key="5" prop="pcsn" label="批次号" align="center" min-width="150" show-overflow-tooltip />
<el-table-column key="5" prop="pcsn" label="批次号" align="center" min-width="150"/>
<el-table-column
key="10"
show-overflow-tooltip
prop="qty"
label="重量"
:formatter="crud.formatNum3"
width="120"
align="center"
/>
<el-table-column key="11" show-overflow-tooltip prop="storagevehicle_code" label="载具号" />
<el-table-column key="12" show-overflow-tooltip prop="turnout_sect_name" label="库区" />
<el-table-column key="14" show-overflow-tooltip prop="turnout_struct_code" label="货位" />
<el-table-column key="15" width="150" show-overflow-tooltip prop="sale_order_name" label="销售订单行号-" />
<el-table-column key="16" width="150" show-overflow-tooltip prop="new_sale_order_name" label="销售订单行号-">
<el-table-column key="11" show-overflow-tooltip prop="storagevehicle_code" label="载具号"/>
<el-table-column key="12" prop="turnout_sect_name" label="库区"/>
<el-table-column key="14" prop="turnout_struct_code" show-overflow-tooltip label="货位"/>
<el-table-column key="15" width="150" prop="sale_order_name" show-overflow-tooltip label="销售订单行号-"/>
<el-table-column key="16" width="150" prop="new_sale_order_name" label="销售订单行号-">
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.new_sale_order_name" class="input-with-select">
</el-input>
<el-input v-show="!scope.row.edit" v-model="scope.row.new_sale_order_name" @input="saleInput(form.tableData[scope.$index])" class="input-with-select"/>
<span v-show="scope.row.edit">{{ scope.row.new_sale_order_name }}</span>
</template>
</el-table-column>
<el-table-column key="17" width="150" show-overflow-tooltip prop="customer_name" label="客户编码-" />
<el-table-column key="18" width="150" show-overflow-tooltip prop="customer_description" label="客户名称-" />
<el-table-column key="19" width="150" show-overflow-tooltip prop="new_customer_name" label="客户编码-">
<el-table-column key="17" width="150" prop="customer_name" label="客户编码-"/>
<el-table-column key="18" width="150" prop="customer_description" label="客户名称-"/>
<el-table-column key="19" width="150" prop="new_customer_name" label="客户编码-">
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.new_customer_name" class="input-with-select">
</el-input>
<span v-show="scope.row.edit">{{ scope.row.new_customer_name }}</span>
</template>
</el-table-column>
<el-table-column key="20" width="150" show-overflow-tooltip prop="new_customer_description" label="客户名称-" >
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.new_customer_description" class="input-with-select">
</el-input>
<span v-show="scope.row.edit">{{ scope.row.new_customer_description }}</span>
</template>
</el-table-column>
<el-table-column key="21" width="150" show-overflow-tooltip prop="demand_date" label="交货日期-">
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.demand_date" class="input-with-select">
<el-input v-show="!scope.row.edit" v-model="scope.row.new_customer_name" @input="custInput(form.tableData[scope.$index])" class="input-with-select">
</el-input>
<span v-show="scope.row.edit">{{ scope.row.demand_date }}</span>
<span v-show="scope.row.edit">{{ scope.row.new_customer_name }}</span>
</template>
</el-table-column>
<el-table-column key="24" width="150" show-overflow-tooltip prop="date_of_fg_inbound" label="制作日期-">
<el-table-column key="20" width="150" prop="new_customer_description" label="客户名称-">
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.date_of_fg_inbound" class="input-with-select">
</el-input>
<span v-show="scope.row.edit">{{ scope.row.date_of_fg_inbound }}</span>
<el-input v-show="!scope.row.edit" v-model="scope.row.new_customer_description" @input="custNameInput(form.tableData[scope.$index])" class="input-with-select">
</el-input>
<span v-show="scope.row.edit">{{ scope.row.new_customer_description }}</span>
</template>
</el-table-column>
<el-table-column key="22" width="150" show-overflow-tooltip prop="isreprintpackageboxlabel" label="更换外包装标签">
<el-table-column key="21" width="300" prop="demand_date" label="交货日期-" >
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.isreprintpackageboxlabel" class="input-with-select">
</el-input>
<span v-show="scope.row.edit">{{ scope.row.isreprintpackageboxlabel }}</span>
<el-date-picker
v-model="scope.row.demand_date"
type="date"
@change="demandChange(form.tableData[scope.$index])"
:disabled="scope.row.edit"
placeholder="选择日期"
value-format="yyyy-MM-dd">
</el-date-picker>
</template>
</el-table-column>
<el-table-column key="23" width="150" show-overflow-tooltip prop="isunpackbox" label="更换子卷标签">
<el-table-column key="24" width="300" prop="date_of_fg_inbound" label="制作日期-" >
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.isunpackbox" class="input-with-select">
</el-input>
<span v-show="scope.row.edit">{{ scope.row.isunpackbox }}</span>
<el-date-picker
v-model="scope.row.date_of_fg_inbound"
type="date"
:disabled="scope.row.edit"
@change="inChange(form.tableData[scope.$index])"
placeholder="选择日期"
value-format="yyyy-MM-dd">
</el-date-picker>
</template>
</el-table-column>
<el-table-column key="22" width="150" prop="isreprintpackageboxlabel" label="更换外包装标签">
<template scope="scope">
<el-switch
:disabled="scope.row.edit"
v-model="scope.row.isreprintpackageboxlabel"
active-value="1"
inactive-value="0"
active-color="#13ce66"
@change="packageChange(form.tableData[scope.$index])"
inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column key="23" width="150" prop="isunpackbox" label="更换子卷标签">
<template scope="scope">
<el-switch
:disabled="scope.row.edit"
v-model="scope.row.isunpackbox"
active-value="1"
inactive-value="0"
@change="boxChange(form.tableData[scope.$index])"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column v-if="crud.status.cu > 0" key="25" align="center" label="操作" width="160" fixed="right">
@@ -254,8 +274,8 @@
</template>
</el-table-column>
</el-table>
<AddDtl :dialog-show.sync="dtlShow" @tableChanged="tableChanged" />
<StructDiv ref="child" :dialog-show.sync="structShow" @tableChanged="structChanged" />
<AddDtl :dialog-show.sync="dtlShow" @tableChanged="tableChanged"/>
<StructDiv ref="child" :dialog-show.sync="structShow" @tableChanged="structChanged"/>
</el-dialog>
</template>
@@ -377,6 +397,63 @@ export default {
}
})
},
saleInput(val) {
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) {
this.$set(this.form.tableData[i], 'new_sale_order_name', val.new_sale_order_name)
this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新
}
}
},
custInput(val) {
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) {
this.$set(this.form.tableData[i], 'new_customer_name', val.new_customer_name)
this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新
}
}
},
custNameInput(val) {
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) {
this.$set(this.form.tableData[i], 'new_customer_description', val.new_customer_description)
this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新
}
}
},
demandChange(val) {
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) {
this.$set(this.form.tableData[i], 'demand_date', val.demand_date)
this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新
}
}
},
inChange(val) {
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) {
this.$set(this.form.tableData[i], 'date_of_fg_inbound', val.date_of_fg_inbound)
this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新
}
}
},
boxChange(val) {
debugger
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) {
this.$set(this.form.tableData[i], 'isunpackbox', val.isunpackbox)
this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新
}
}
},
packageChange(val) {
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) {
this.$set(this.form.tableData[i], 'isreprintpackageboxlabel', val.isreprintpackageboxlabel)
this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新
}
}
},
async queryDtl() {
this.dtlShow = true
},
@@ -452,12 +529,6 @@ export default {
},
handleEdit(index, row) {
// 判断是否可以关闭编辑状态
if (!row.edit) {
/*if (row.turnin_struct_id === '') {
this.crud.notify('请先选择载具:' + row.storagevehicle_code + '的移入货位!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}*/
}
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
if (row.edit) {