add:分拣出库
This commit is contained in:
@@ -76,11 +76,19 @@
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name,
|
||||
sub.box_weight,
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60'
|
||||
AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
|
||||
WHEN SUBSTRING( sub.container_name, 1, 1 ) = 'B' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '150' AND DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '180' THEN '3'
|
||||
END
|
||||
|
||||
WHEN SUBSTRING( sub.container_name, 1, 1 ) <> 'B' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
|
||||
END
|
||||
END AS sub_type,
|
||||
DATEDIFF( NOW(), sub.date_of_production ) AS stock_age
|
||||
|
||||
|
||||
@@ -366,7 +366,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
JSONObject json = item.getJSONObject(i);
|
||||
lfart = json.getString("LFART");
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
if (StrUtil.equals(lfart, "ZLF")) {
|
||||
if (StrUtil.equals(lfart, "ZLF") || StrUtil.equals(lfart, "ZJS")) {
|
||||
// 生成出库单
|
||||
jsonMst.put("io_type", "1");
|
||||
jsonMst.put("buss_type", "1001");
|
||||
@@ -485,8 +485,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
box_rows.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 发货出库
|
||||
if (StrUtil.equals(lfart, "ZLF")) {
|
||||
jsonMst.put("tableData", tableData);
|
||||
// 调用出库新增并分配
|
||||
@@ -494,6 +493,17 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("iostorinv_id", iostorinv_id);
|
||||
}
|
||||
// 分拣出库
|
||||
if (StrUtil.equals(lfart, "ZJS")) {
|
||||
jsonMst.put("buss_type", "1011");
|
||||
jsonMst.put("bill_type", "1011");
|
||||
jsonMst.put("tableData", tableData);
|
||||
// 调用出库新增并分配
|
||||
String iostorinv_id = checkOutBillService.insertDtl2(jsonMst);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("iostorinv_id", iostorinv_id);
|
||||
}
|
||||
// 退货入库
|
||||
if (StrUtil.equals(lfart, "ZLR")) {
|
||||
jsonMst.put("tableData", box_rows);
|
||||
//创建退货入库单
|
||||
|
||||
@@ -319,4 +319,13 @@ public interface CheckOutBillService {
|
||||
* @param request、
|
||||
*/
|
||||
void importExcel(MultipartFile file, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 更新分拣出库重量
|
||||
* @param whereJson {
|
||||
* dtl: 明细数据
|
||||
* tabledis: 分配明细集合
|
||||
* }
|
||||
*/
|
||||
void saveUpdate(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -320,4 +320,11 @@ public class CheckOutBillController {
|
||||
checkOutBillService.importExcel(file, request);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/saveUpdate")
|
||||
@Log("更新分拣出库重量")
|
||||
public ResponseEntity<Object> saveUpdate(@RequestBody JSONObject whereJson) {
|
||||
checkOutBillService.saveUpdate(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1241,6 +1241,72 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveUpdate(JSONObject whereJson) {
|
||||
// 分配明细表
|
||||
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis");
|
||||
// 明细表
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
|
||||
// 库存表
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
|
||||
JSONObject jsonDtl = whereJson.getJSONObject("dtl");
|
||||
List<JSONObject> disArr = whereJson.getJSONArray("tabledis").toJavaList(JSONObject.class);
|
||||
|
||||
for (int i = 0; i < disArr.size(); i++) {
|
||||
JSONObject json = disArr.get(i);
|
||||
|
||||
// 输入数量不能为零
|
||||
if (json.getDoubleValue("plan_qty") == 0) {
|
||||
throw new BadRequestException("输入数量不能为0!");
|
||||
}
|
||||
|
||||
// 更新冻结库存
|
||||
JSONObject jsonIvt = ivtTab.query("pcsn = '" + json.getString("pcsn") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
throw new BadRequestException("库存不存在!"+json.getString("pcsn"));
|
||||
}
|
||||
|
||||
jsonIvt.put("frozen_qty", json.getDoubleValue("plan_qty"));
|
||||
// 冻结库存不能超过库存数量
|
||||
if (jsonIvt.getDoubleValue("frozen_qty") > jsonIvt.getDoubleValue("ivt_qty")) {
|
||||
throw new BadRequestException("输入数量不能大于库存数量! 当前库存数为:"+jsonIvt.getString("ivt_qty"));
|
||||
}
|
||||
|
||||
// 更新库存数
|
||||
double canuse_qty = NumberUtil.sub(jsonIvt.getDoubleValue("ivt_qty"), jsonIvt.getDoubleValue("frozen_qty"));
|
||||
jsonIvt.put("canuse_qty",canuse_qty);
|
||||
|
||||
ivtTab.update(jsonIvt);
|
||||
|
||||
// 更新分配明细
|
||||
json.put("real_qty", json.getDoubleValue("plan_qty"));
|
||||
disTab.update(json);
|
||||
}
|
||||
|
||||
// 更新明细
|
||||
double assign_qty = disArr.stream()
|
||||
.map(row -> row.getDoubleValue("plan_qty"))
|
||||
.reduce(Double::sum).orElse(0.00);
|
||||
// 已分配重量
|
||||
jsonDtl.put("assign_qty", assign_qty);
|
||||
|
||||
// 未分配重量/明细状态
|
||||
double unassign_qty = NumberUtil.sub(jsonDtl.getDoubleValue("plan_qty"), assign_qty);
|
||||
if (unassign_qty <= 0) {
|
||||
jsonDtl.put("unassign_qty", 0);
|
||||
jsonDtl.put("bill_status", "40");
|
||||
} else {
|
||||
jsonDtl.put("unassign_qty", unassign_qty);
|
||||
jsonDtl.put("bill_status", "30");
|
||||
}
|
||||
dtlTab.update(jsonDtl);
|
||||
|
||||
// 更新主表状态
|
||||
updateMststatus(jsonDtl.getString("iostorinv_id"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
@@ -2472,8 +2538,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
//查询主表信息
|
||||
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||
// 查询此分配明细下的所有相同箱号的分配明细
|
||||
JSONArray diss = wo_dis.query("box_no = '" + whereJson.getString("storagevehicle_code") + "' and iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
// 查询此分配明细下的所有相同箱号的分配明细-- 如果为分拣出库则只需要更新当前子卷库存
|
||||
JSONArray diss;
|
||||
if (jo_mst.getString("bill_type").equals("1011")) {
|
||||
diss = wo_dis.query("pcsn = '" + whereJson.getString("pcsn") + "' and iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
|
||||
} else {
|
||||
diss = wo_dis.query("box_no = '" + whereJson.getString("storagevehicle_code") + "' and iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < diss.size(); i++) {
|
||||
JSONObject dis = diss.getJSONObject(i);
|
||||
@@ -2544,18 +2617,28 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
map.put("is_delete", "1");
|
||||
wo_Task.update(map, "task_id='" + dis.getString("task_id") + "'");
|
||||
}
|
||||
//解锁起点仓位点位
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("struct_id", dis.getString("struct_id"));
|
||||
from_start.put("lock_type", "1");
|
||||
storPublicService.updateStructAndPoint2(from_start);
|
||||
//解锁终点仓位点位
|
||||
if (StrUtil.isNotEmpty(dis.getString("point_code"))) {
|
||||
JSONObject from_end = new JSONObject();
|
||||
from_end.put("point_code", dis.getString("point_code"));
|
||||
from_end.put("lock_type", "1");
|
||||
storPublicService.updateStructAndPoint2(from_end);
|
||||
//解锁起点仓位点位: 判断此仓位是否还有库存
|
||||
List<JSONObject> ivtList = WQLObject.getWQLObject("st_ivt_structivt")
|
||||
.query("struct_id = '" + dis.getString("struct_id") + "'")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
boolean is_zero = ivtList.stream()
|
||||
.allMatch(row -> row.getDoubleValue("frozen_qty") == 0);
|
||||
|
||||
if (is_zero) {
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("struct_id", dis.getString("struct_id"));
|
||||
from_start.put("lock_type", "1");
|
||||
storPublicService.updateStructAndPoint2(from_start);
|
||||
//解锁终点仓位点位
|
||||
if (StrUtil.isNotEmpty(dis.getString("point_code"))) {
|
||||
JSONObject from_end = new JSONObject();
|
||||
from_end.put("point_code", dis.getString("point_code"));
|
||||
from_end.put("lock_type", "1");
|
||||
storPublicService.updateStructAndPoint2(from_end);
|
||||
}
|
||||
}
|
||||
|
||||
} else {//仓位载具扔有冻结数,需改任务类型为拣选出库
|
||||
//任务号不为空
|
||||
/* if (ObjectUtil.isNotEmpty(dis.getString("task_id"))) {
|
||||
|
||||
@@ -660,7 +660,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
}
|
||||
|
||||
// 销售出库
|
||||
if (StrUtil.equals(bill_type, "1001")) {
|
||||
if (StrUtil.equals(bill_type, "1001") || StrUtil.equals(bill_type, "1011")) {
|
||||
// 1.回传sap
|
||||
JSONArray paramSapMstArr = new JSONArray();
|
||||
|
||||
@@ -1284,7 +1284,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
}
|
||||
|
||||
// 销售出库
|
||||
if (StrUtil.equals(bill_type, "1001")) {
|
||||
if (StrUtil.equals(bill_type, "1001") || StrUtil.equals(bill_type, "1011") ) {
|
||||
// 1.回传sap
|
||||
JSONArray paramSapMstArr = new JSONArray();
|
||||
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
v-if="this.mstrow.bill_type !== '1011'"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@@ -239,6 +238,19 @@
|
||||
>
|
||||
一键设置
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
v-if="this.mstrow.bill_type === '1011'"
|
||||
class="filter-item"
|
||||
:loading="loadingSetAllPoint"
|
||||
type="warning"
|
||||
icon="el-icon-check"
|
||||
:disabled="button5"
|
||||
size="mini"
|
||||
@click="saveUpdate"
|
||||
>
|
||||
保存修改
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
|
||||
@@ -273,11 +285,16 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_code" label="物料编码" width="150px" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="material_name" label="物料名称" width="150px" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||||
<el-table-column prop="material_name" label="物料名称" width="170px" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||||
<el-table-column prop="box_no" label="木箱号" width="250px" :min-width="flexWidth('box_no',crud.data,'木箱号')" />
|
||||
<el-table-column prop="pcsn" label="子卷批次号" width="150px" :min-width="flexWidth('pcsn',crud.data,'子卷批次号')" />
|
||||
<el-table-column prop="sap_pcsn" label="sap批次号" width="150px" :min-width="flexWidth('sap_pcsn',crud.data,'sap批次号')" />
|
||||
<el-table-column show-overflow-tooltip prop="plan_qty" label="出库重量" :formatter="crud.formatNum3" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="plan_qty" label="出库重量" :formatter="crud.formatNum3" align="center" width="120px" :min-width="flexWidth('plan_qty',crud.data,'出库重量')" >
|
||||
<template scope="scope">
|
||||
<el-input-number v-show="mstrow.bill_type === '1011'" v-model="scope.row.plan_qty" :precision="3" :controls="false" :min="1" style="width: 90px" />
|
||||
<span v-show="mstrow.bill_type !== '1011'" >{{ parseFloat(scope.row.plan_qty).toFixed(3) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="struct_code" width="150px" label="仓位编码" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="struct_name" width="150px" label="仓位名称" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="is_overdue" width="150px" label="是否超期" align="center" :formatter="formatOverdue" />
|
||||
@@ -655,6 +672,25 @@ export default {
|
||||
this.loadingSetAllPoint = false
|
||||
})
|
||||
},
|
||||
saveUpdate() {
|
||||
if (this.tabledis.length === 0) {
|
||||
this.crud.notify('分配明细为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
this.loadingSetAllPoint = true
|
||||
const data = {
|
||||
'dtl': this.currentRow,
|
||||
'tabledis': this.tabledis
|
||||
}
|
||||
checkoutbill.saveUpdate(data).then(res => {
|
||||
this.queryTableDtl()
|
||||
this.queryTableDdis(this.currentRow.iostorinvdtl_id)
|
||||
this.crud.notify('保存成功!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
this.loadingSetAllPoint = false
|
||||
}).catch(() => {
|
||||
this.loadingSetAllPoint = false
|
||||
})
|
||||
},
|
||||
allSetPointAllDtl() {
|
||||
if (this.form2.point_code === '') {
|
||||
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
|
||||
@@ -255,4 +255,11 @@ export function excelImport(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, getOutBillDis2, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, updataIsOverdue, excelImport }
|
||||
export function saveUpdate(data) {
|
||||
return request({
|
||||
url: '/api/checkoutbill/saveUpdate',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, getOutBillDis2, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, updataIsOverdue, excelImport, saveUpdate }
|
||||
|
||||
Reference in New Issue
Block a user