|
@@ -2,6 +2,7 @@ package com.steerinfo.dil.controller;
|
|
|
|
|
|
import com.steerinfo.dil.feign.ESFeign;
|
|
|
import com.steerinfo.dil.mapper.CommonSeq;
|
|
|
+import com.steerinfo.dil.mapper.WmspInboundScanResultMapper;
|
|
|
import com.steerinfo.dil.model.WmspOutboundResult;
|
|
|
import com.steerinfo.dil.model.WmspOutboundScanResult;
|
|
|
import com.steerinfo.dil.service.IWmspOutboundResultService;
|
|
@@ -21,10 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* WmspOutboundResult RESTful接口:
|
|
@@ -46,6 +44,8 @@ public class WmspOutboundResultController extends BaseRESTfulController {
|
|
|
@Autowired
|
|
|
WmspOutboundResultServiceImpl wmspOutboundResultService;
|
|
|
@Autowired
|
|
|
+ WmspInboundScanResultMapper wmspInboundScanResultMapper;
|
|
|
+ @Autowired
|
|
|
CommonSeq commonSeq;
|
|
|
@Autowired
|
|
|
ESFeign esFeign;
|
|
@@ -150,87 +150,89 @@ public class WmspOutboundResultController extends BaseRESTfulController {
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("orderId",orderId);
|
|
|
map.put("materialId",materialId);
|
|
|
- int orderNum = wmspOutboundResultService.ExistWmspOutboundResult(map);
|
|
|
//初始化出库单详情信息
|
|
|
Map<String, Object> outBoundDetailedInfo=null;
|
|
|
- if(orderNum == 0){
|
|
|
- /**创建出库单实体*/
|
|
|
- WmspOutboundResult wmspOutboundResult = new WmspOutboundResult();
|
|
|
- /**使用序列号增加生成主键id*/
|
|
|
- int seq_wmspoutboundresult = commonSeq.getSeqNumber("seq__WMSP_OUTBOUND_RESULT");
|
|
|
- /**获取到当前时间*/
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
- /**生成出库单编号*/
|
|
|
- String resultNumber = "XSCK" + sdf.format(new Date());
|
|
|
- if(seq_wmspoutboundresult < 10){
|
|
|
- resultNumber += "0000000" + seq_wmspoutboundresult;
|
|
|
- }else if(seq_wmspoutboundresult < 100){
|
|
|
- resultNumber += "000000" + seq_wmspoutboundresult;
|
|
|
- }else if(seq_wmspoutboundresult < 1000){
|
|
|
- resultNumber += "00000" + seq_wmspoutboundresult;
|
|
|
- }else if(seq_wmspoutboundresult < 10000){
|
|
|
- resultNumber += "0000" + seq_wmspoutboundresult;
|
|
|
- }else if(seq_wmspoutboundresult < 100000){
|
|
|
- resultNumber += "000" + seq_wmspoutboundresult;
|
|
|
- }else if(seq_wmspoutboundresult < 1000000){
|
|
|
- resultNumber += "00" + seq_wmspoutboundresult;
|
|
|
- }else if(seq_wmspoutboundresult < 10000000){
|
|
|
- resultNumber += "0" + seq_wmspoutboundresult;
|
|
|
- }else{
|
|
|
- resultNumber += seq_wmspoutboundresult;
|
|
|
- }
|
|
|
- /**拿到运输订单类型*/
|
|
|
- BigDecimal orderType = (BigDecimal) order.get("orderType");
|
|
|
- /**运输订单类型判断
|
|
|
- * orderType : 1 为普通出库
|
|
|
- * orderType : 4 为调拨出库
|
|
|
- * */
|
|
|
- String resultOutboundType = "普通出库";
|
|
|
- if(orderType.intValue() == 4){
|
|
|
- resultOutboundType = "调拨出库";
|
|
|
- }
|
|
|
- /**把出库单主键id添加到出库单实体中*/
|
|
|
- wmspOutboundResult.setResultId(new BigDecimal(seq_wmspoutboundresult));
|
|
|
- /**把出库单编号添加到出库单实体中*/
|
|
|
- wmspOutboundResult.setResultNumber(resultNumber);
|
|
|
- /**把运输订单主键添加到出库单实体中*/
|
|
|
- wmspOutboundResult.setBillLadingId(orderId);
|
|
|
- /**把出库类型添加到出库单实体中*/
|
|
|
- wmspOutboundResult.setResultOutboundType(resultOutboundType);
|
|
|
- /**第一次添加为待出库*/
|
|
|
- wmspOutboundResult.setResultStatus(new BigDecimal(0));
|
|
|
- //常规字段
|
|
|
- wmspOutboundResult.setInsertUsername("admin");
|
|
|
- wmspOutboundResult.setInsertTime(new Date());
|
|
|
- wmspOutboundResult.setUpdateUsername("admin");
|
|
|
- wmspOutboundResult.setUpdateTime(new Date());
|
|
|
- wmspOutboundResult.setInsertUpdateRemark("无");
|
|
|
- wmspOutboundResult.setDeleted(new BigDecimal(0));
|
|
|
- //还没装货的物资id的第一条添加到出库单实体中
|
|
|
- wmspOutboundResult.setMaterialId(materialId);
|
|
|
- Integer res = wmspOutboundResultService.insertSelective(wmspOutboundResult);
|
|
|
- if(res == 1){
|
|
|
+ if ("".equals(wmspOutboundResultService.ExistWmspOutboundResult(map))){
|
|
|
+ int orderNum = wmspOutboundResultService.ExistWmspOutboundResult(map);
|
|
|
+ if(orderNum == 0){
|
|
|
+ /**创建出库单实体*/
|
|
|
+ WmspOutboundResult wmspOutboundResult = new WmspOutboundResult();
|
|
|
+ /**使用序列号增加生成主键id*/
|
|
|
+ int seq_wmspoutboundresult = commonSeq.getSeqNumber("seq__WMSP_OUTBOUND_RESULT");
|
|
|
+ /**获取到当前时间*/
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ /**生成出库单编号*/
|
|
|
+ String resultNumber = "XSCK" + sdf.format(new Date());
|
|
|
+ if(seq_wmspoutboundresult < 10){
|
|
|
+ resultNumber += "0000000" + seq_wmspoutboundresult;
|
|
|
+ }else if(seq_wmspoutboundresult < 100){
|
|
|
+ resultNumber += "000000" + seq_wmspoutboundresult;
|
|
|
+ }else if(seq_wmspoutboundresult < 1000){
|
|
|
+ resultNumber += "00000" + seq_wmspoutboundresult;
|
|
|
+ }else if(seq_wmspoutboundresult < 10000){
|
|
|
+ resultNumber += "0000" + seq_wmspoutboundresult;
|
|
|
+ }else if(seq_wmspoutboundresult < 100000){
|
|
|
+ resultNumber += "000" + seq_wmspoutboundresult;
|
|
|
+ }else if(seq_wmspoutboundresult < 1000000){
|
|
|
+ resultNumber += "00" + seq_wmspoutboundresult;
|
|
|
+ }else if(seq_wmspoutboundresult < 10000000){
|
|
|
+ resultNumber += "0" + seq_wmspoutboundresult;
|
|
|
+ }else{
|
|
|
+ resultNumber += seq_wmspoutboundresult;
|
|
|
+ }
|
|
|
+ /**拿到运输订单类型*/
|
|
|
+ BigDecimal orderType = (BigDecimal) order.get("orderType");
|
|
|
+ /**运输订单类型判断
|
|
|
+ * orderType : 1 为普通出库
|
|
|
+ * orderType : 4 为调拨出库
|
|
|
+ * */
|
|
|
+ String resultOutboundType = "普通出库";
|
|
|
+ if(orderType.intValue() == 4){
|
|
|
+ resultOutboundType = "调拨出库";
|
|
|
+ }
|
|
|
+ /**把出库单主键id添加到出库单实体中*/
|
|
|
+ wmspOutboundResult.setResultId(new BigDecimal(seq_wmspoutboundresult));
|
|
|
+ /**把出库单编号添加到出库单实体中*/
|
|
|
+ wmspOutboundResult.setResultNumber(resultNumber);
|
|
|
+ /**把运输订单主键添加到出库单实体中*/
|
|
|
+ wmspOutboundResult.setBillLadingId(orderId);
|
|
|
+ /**把出库类型添加到出库单实体中*/
|
|
|
+ wmspOutboundResult.setResultOutboundType(resultOutboundType);
|
|
|
+ /**第一次添加为待出库*/
|
|
|
+ wmspOutboundResult.setResultStatus(new BigDecimal(0));
|
|
|
+ //常规字段
|
|
|
+ wmspOutboundResult.setInsertUsername("admin");
|
|
|
+ wmspOutboundResult.setInsertTime(new Date());
|
|
|
+ wmspOutboundResult.setUpdateUsername("admin");
|
|
|
+ wmspOutboundResult.setUpdateTime(new Date());
|
|
|
+ wmspOutboundResult.setInsertUpdateRemark("无");
|
|
|
+ wmspOutboundResult.setDeleted(new BigDecimal(0));
|
|
|
+ //还没装货的物资id的第一条添加到出库单实体中
|
|
|
+ wmspOutboundResult.setMaterialId(materialId);
|
|
|
+ Integer res = wmspOutboundResultService.insertSelective(wmspOutboundResult);
|
|
|
+ if(res == 1){
|
|
|
|
|
|
+ //返回出库单详情信息
|
|
|
+ outBoundDetailedInfo = wmspOutboundResultService.getOutBoundDetailedInfo(orderId);
|
|
|
+ outBoundDetailedInfo.put("orderNumber",orderNumber);
|
|
|
+// outBoundDetailedInfo.put("personnelName",personnelName);
|
|
|
+ outBoundDetailedInfo.put("materialCode",materialCode);
|
|
|
+ outBoundDetailedInfo.put("materialName",materialName);
|
|
|
+ outBoundDetailedInfo.put("materialSpecification",materialSpecification);
|
|
|
+ outBoundDetailedInfo.put("materialModel",materialModel);
|
|
|
+ outBoundDetailedInfo.put("materialTheoreticalWeight",materialTheoreticalWeight);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
//返回出库单详情信息
|
|
|
outBoundDetailedInfo = wmspOutboundResultService.getOutBoundDetailedInfo(orderId);
|
|
|
outBoundDetailedInfo.put("orderNumber",orderNumber);
|
|
|
-// outBoundDetailedInfo.put("personnelName",personnelName);
|
|
|
+// outBoundDetailedInfo.put("personnelName",personnelName);
|
|
|
outBoundDetailedInfo.put("materialCode",materialCode);
|
|
|
outBoundDetailedInfo.put("materialName",materialName);
|
|
|
outBoundDetailedInfo.put("materialSpecification",materialSpecification);
|
|
|
outBoundDetailedInfo.put("materialModel",materialModel);
|
|
|
outBoundDetailedInfo.put("materialTheoreticalWeight",materialTheoreticalWeight);
|
|
|
}
|
|
|
- }else{
|
|
|
- //返回出库单详情信息
|
|
|
- outBoundDetailedInfo = wmspOutboundResultService.getOutBoundDetailedInfo(orderId);
|
|
|
- outBoundDetailedInfo.put("orderNumber",orderNumber);
|
|
|
-// outBoundDetailedInfo.put("personnelName",personnelName);
|
|
|
- outBoundDetailedInfo.put("materialCode",materialCode);
|
|
|
- outBoundDetailedInfo.put("materialName",materialName);
|
|
|
- outBoundDetailedInfo.put("materialSpecification",materialSpecification);
|
|
|
- outBoundDetailedInfo.put("materialModel",materialModel);
|
|
|
- outBoundDetailedInfo.put("materialTheoreticalWeight",materialTheoreticalWeight);
|
|
|
}
|
|
|
return outBoundDetailedInfo;
|
|
|
}
|
|
@@ -286,11 +288,6 @@ public class WmspOutboundResultController extends BaseRESTfulController {
|
|
|
//通过装卸工工号查询装卸工Id
|
|
|
BigDecimal personnelId = wmspOutboundResultService.getPersonnelIdByJobnumber(personnelJobNumber);
|
|
|
//通过出库实绩Id判断出库单已扫描的件数是否等于运输订单物资表的物资件数
|
|
|
- int EqualMaterialsNumber = wmspOutboundResultService.EqualMaterialsNumber(resultId);
|
|
|
- if(EqualMaterialsNumber==1){
|
|
|
- //相等返回装货数量已够
|
|
|
- return failed("装货数量已够");
|
|
|
- }else {
|
|
|
///解析物质二维码信息
|
|
|
//截取扫描结果,得到物资唯一编码
|
|
|
String[] split = resultMaterial.split("-");
|
|
@@ -308,6 +305,11 @@ public class WmspOutboundResultController extends BaseRESTfulController {
|
|
|
int seq_wmspOutboundScanResult = commonSeq.getSeqNumber("seq__WMSP_OUTBOUND_SCAN_RESULT");
|
|
|
//插入主键id
|
|
|
wmspOutboundScanResult.setResultId(new BigDecimal(seq_wmspOutboundScanResult));
|
|
|
+ //根据物资id查询相对应的入库实绩ID,并将其赋值给相对应的入库扫描实绩表
|
|
|
+ List<Map<String, Object>> list= wmspInboundScanResultMapper.getInboundResultIdByMaterial(subResultMaterial);
|
|
|
+// 默认以获取到的第一个值作为入库实绩Id
|
|
|
+ Map<String ,Object> map1 = list.get(0);
|
|
|
+ wmspOutboundScanResult.setInboundResultId((BigDecimal) map1.get("inboundResultId"));
|
|
|
//插入出库实绩ID
|
|
|
wmspOutboundScanResult.setOutboundResultId(resultId);
|
|
|
//插入装卸工Id
|
|
@@ -325,8 +327,15 @@ public class WmspOutboundResultController extends BaseRESTfulController {
|
|
|
wmspOutboundScanResult.setUpdateTime(new Date());
|
|
|
wmspOutboundScanResult.setInsertUpdateRemark("无");
|
|
|
if(SteelMaterialId.intValue()==OutboundMaterialId.intValue()){
|
|
|
- //稽核成功,设定扫描实绩稽核结果为成功
|
|
|
- wmspOutboundScanResult.setResultCheck(new BigDecimal(0));
|
|
|
+ int EqualMaterialsNumber = wmspOutboundResultService.EqualMaterialsNumber(resultId);
|
|
|
+ if(EqualMaterialsNumber==1){
|
|
|
+ //相等返回装货数量已够
|
|
|
+ wmspOutboundScanResult.setResultCheck(new BigDecimal(1));
|
|
|
+ }else {
|
|
|
+ //稽核成功,设定扫描实绩稽核结果为成功
|
|
|
+ wmspOutboundScanResult.setResultCheck(new BigDecimal(0));
|
|
|
+ }
|
|
|
+
|
|
|
//插入扫描实绩
|
|
|
wmspOutboundResultService.scanResultInsert(wmspOutboundScanResult);
|
|
|
}else {
|
|
@@ -346,7 +355,9 @@ public class WmspOutboundResultController extends BaseRESTfulController {
|
|
|
//theSameOutboundInfo.put("warehouseName",warehouseName);
|
|
|
//2、获取出库扫描实绩数据
|
|
|
List<Map<String,Object>> scanAuditSuccessInfo = wmspOutboundResultService.scanAuditSuccessInfo(resultId);
|
|
|
- //补全出库扫描实绩数据的信息
|
|
|
+ //补全出库扫描实绩数据的信息,对扫描实绩进行去重
|
|
|
+
|
|
|
+
|
|
|
for (Map<String, Object> stringObjectMap : scanAuditSuccessInfo) {
|
|
|
String resultMaterial1 = (String) stringObjectMap.get("resultMaterial");
|
|
|
//截取扫描结果,得到一件物资的详细信息
|
|
@@ -381,7 +392,7 @@ public class WmspOutboundResultController extends BaseRESTfulController {
|
|
|
stringObjectMap.putAll(theSameOutboundInfo);
|
|
|
}
|
|
|
return success(scanAuditSuccessInfo);
|
|
|
- }
|
|
|
+
|
|
|
}else{
|
|
|
//返回已扫描并并稽核成功的物资信息
|
|
|
//1、获取出库单统一信息
|