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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user