|
|
@ -23,6 +23,7 @@ import com.win.module.wms.dal.dataobject.productionline.ProductionlineDO; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRecord.PurchasereceiptRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRequest.PurchasereceiptRequestDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRequest.PurchasereceiptRequestMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.repleinshRecord.RepleinshRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.repleinshRequest.RepleinshRequestDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.repleinshRequest.RepleinshRequestMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.workshop.WorkshopDO; |
|
|
@ -40,6 +41,10 @@ import com.win.module.wms.service.productreceiptRecord.ProductreceiptRecordMainS |
|
|
|
import com.win.module.wms.service.purchasereceiptRecord.PurchasereceiptRecordDetailService; |
|
|
|
import com.win.module.wms.service.purchasereceiptRequest.PurchasereceiptRequestDetailService; |
|
|
|
import com.win.module.wms.service.purchasereceiptRequest.PurchasereceiptRequestMainService; |
|
|
|
import com.win.module.wms.service.repleinshJob.RepleinshJobMainService; |
|
|
|
import com.win.module.wms.service.repleinshRecord.RepleinshRecordMainService; |
|
|
|
import com.win.module.wms.service.repleinshRequest.RepleinshRequestDetailService; |
|
|
|
import com.win.module.wms.service.repleinshRequest.RepleinshRequestMainService; |
|
|
|
import com.win.module.wms.service.workshop.WorkshopService; |
|
|
|
import com.win.module.wms.service.workstation.WorkstationService; |
|
|
|
import com.win.module.wms.util.JobUtils; |
|
|
@ -109,6 +114,14 @@ public class OuterController { |
|
|
|
private PurchasereceiptRequestDetailService purchasereceiptRequestDetailService; |
|
|
|
@Resource |
|
|
|
private PurchasereceiptRecordDetailService purchasereceiptRecordDetailService; |
|
|
|
@Resource |
|
|
|
private RepleinshRequestMainService repleinshRequestMainService; |
|
|
|
@Resource |
|
|
|
private RepleinshRequestDetailService repleinshRequestDetailService; |
|
|
|
@Resource |
|
|
|
private RepleinshJobMainService repleinshJobMainService; |
|
|
|
@Resource |
|
|
|
private RepleinshRecordMainService repleinshRecordMainService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 对外提供一个接口,通过header中的interfaceName反射机制调用方法,方法必须写到这个controller中,并且不用加PostMapping注解。 |
|
|
@ -160,10 +173,36 @@ public class OuterController { |
|
|
|
return this.productReceipt(body); |
|
|
|
} else if("accountIntoOrder".equals(interfaceName)) {// 制品收货
|
|
|
|
return this.purchasereceiptReceipt(body); |
|
|
|
} else if("accountOutOrder".equals(interfaceName)) {// 补料
|
|
|
|
return this.repleinsh(body); |
|
|
|
} |
|
|
|
throw exception(INTERFACE_ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 补料 |
|
|
|
* @param body 参数 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
private CommonResult<String> repleinsh(String body) { |
|
|
|
AmvAccountOutOrder amvAccountOutOrder = JsonUtils.parseObject(body, AmvAccountOutOrder.class); |
|
|
|
if(amvAccountOutOrder == null) { |
|
|
|
throw exception(PURCHASERECEIPT_NO_DATA); |
|
|
|
} |
|
|
|
String number = amvAccountOutOrder.getReqCode(); |
|
|
|
//插入记录
|
|
|
|
Long hisId = insertHis(number, "accountOutOrder", body); |
|
|
|
OuterApiHisDTO outerApiHisDTO = outerApiHisApi.getOuterApiHis(hisId,"TRUE"); |
|
|
|
try { |
|
|
|
String recordNumber = this.insertRepleinsh(amvAccountOutOrder); |
|
|
|
updateHis(outerApiHisDTO, recordNumber, true); |
|
|
|
return CommonResult.success(recordNumber); |
|
|
|
} catch (Exception e) { |
|
|
|
updateHis(outerApiHisDTO, e.getMessage(), false); |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 采购收货 |
|
|
|
* @param body 参数 |
|
|
@ -315,10 +354,48 @@ public class OuterController { |
|
|
|
updateHis(outerApiHisDTO, e.getMessage(), false); |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} else if("accountOutOrder".equals(outerApiHisDTO.getType())) { // 入库单据过账
|
|
|
|
try { |
|
|
|
AmvAccountOutOrder amvAccountOutOrder = JsonUtils.parseObject(outerApiHisDTO.getContent(), AmvAccountOutOrder.class); |
|
|
|
String number = this.insertRepleinsh(amvAccountOutOrder); |
|
|
|
updateHis(outerApiHisDTO, number, true); |
|
|
|
return CommonResult.success(number); |
|
|
|
} catch (Exception e) { |
|
|
|
updateHis(outerApiHisDTO, e.getMessage(), false); |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
throw exception(INTERFACE_ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 创建补料记录 |
|
|
|
* @param amvAccountOutOrder 发料VO |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
private String insertRepleinsh(AmvAccountOutOrder amvAccountOutOrder) { |
|
|
|
RepleinshRequestMainDO repleinshRequestMainDO = repleinshRequestMainService.getRepleinshRequestMainByNumber(amvAccountOutOrder.getReqCode()); |
|
|
|
if(repleinshRequestMainDO == null) { |
|
|
|
throw exception(REPLEINSH_NO_DATA, amvAccountOutOrder.getReqCode()); |
|
|
|
} |
|
|
|
List<RepleinshRequestDetailDO> repleinshRequestDetailDOList = repleinshRequestDetailService.selectList(repleinshRequestMainDO.getId()); |
|
|
|
List<RepleinshRequestDetailDO> tempList = new ArrayList<>(); |
|
|
|
for(AmvAccountOutOrder.AmvAccountOutOrderDetail amvAccountOutOrderDetail : amvAccountOutOrder.getData()) { |
|
|
|
// 根据便次号查找
|
|
|
|
RepleinshRequestDetailDO repleinshRequestDetailDO = repleinshRequestDetailDOList.stream().filter(detail -> detail.getDeliNo().equals(amvAccountOutOrderDetail.getRealNum())).findFirst().orElse(null); |
|
|
|
// 同一个包装不能重复收货
|
|
|
|
List<RepleinshRecordDetailDO> list = repleinshRecordMainService.selectListByPackingNumber(amvAccountOutOrder.getReqCode(), amvAccountOutOrderDetail.getOrderItem()); |
|
|
|
if(list != null && !list.isEmpty()) { |
|
|
|
throw exception(CAN_NOT_REPEAT_REPLEINSH, amvAccountOutOrderDetail.getOrderItem()); |
|
|
|
} |
|
|
|
// 数量以申请为准
|
|
|
|
// repleinshRequestDetailDO.setQty(new BigDecimal(repleinshRequestDetailDO.getQty()));
|
|
|
|
tempList.add(repleinshRequestDetailDO); |
|
|
|
} |
|
|
|
//return repleinshJobMainService.directlyGenerateRepleinshRecord(repleinshRequestMainDO, tempList);
|
|
|
|
return ""; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 创建采购收货记录 |
|
|
|
* @param amvAccountIntoOrder 采收收货VO |
|
|
@ -332,8 +409,8 @@ public class OuterController { |
|
|
|
List<PurchasereceiptRequestDetailDO> purchasereceiptRequestDetailDOList = purchasereceiptRequestDetailService.selectList(purchasereceiptRequestMainDO.getId()); |
|
|
|
List<PurchasereceiptRequestDetailDO> tempList = new ArrayList<>(); |
|
|
|
for(AmvAccountIntoOrder.AmvAccountIntoOrderDetail amvAccountIntoOrderDetail : amvAccountIntoOrder.getData()) { |
|
|
|
// 包装号后五位一致
|
|
|
|
PurchasereceiptRequestDetailDO purchasereceiptRequestDetailDO = purchasereceiptRequestDetailDOList.stream().filter(detail -> detail.getPackingNumber().substring(detail.getPackingNumber().length() - 5).equals(amvAccountIntoOrderDetail.getOrderItem())).findFirst().orElse(null); |
|
|
|
// 根据包装号查找
|
|
|
|
PurchasereceiptRequestDetailDO purchasereceiptRequestDetailDO = purchasereceiptRequestDetailDOList.stream().filter(detail -> detail.getPackingNumber().equals(amvAccountIntoOrderDetail.getOrderItem())).findFirst().orElse(null); |
|
|
|
// 同一个包装不能重复收货
|
|
|
|
List<PurchasereceiptRecordDetailDO> list = purchasereceiptRecordDetailService.selectListByPackingNumber(amvAccountIntoOrder.getReqCode(), purchasereceiptRequestDetailDO.getPackingNumber()); |
|
|
|
if(list != null && !list.isEmpty()) { |
|
|
@ -730,6 +807,16 @@ public class OuterController { |
|
|
|
updateHis(outerApiHisDTO, e.getMessage(), false); |
|
|
|
fail +=1; |
|
|
|
} |
|
|
|
} else if("accountOutOrder".equals(outerApiHisDTO.getType())) { // 入库单据过账
|
|
|
|
try { |
|
|
|
AmvAccountOutOrder amvAccountOutOrder = JsonUtils.parseObject(outerApiHisDTO.getContent(), AmvAccountOutOrder.class); |
|
|
|
String number = this.insertRepleinsh(amvAccountOutOrder); |
|
|
|
updateHis(outerApiHisDTO, number, true); |
|
|
|
success +=1; |
|
|
|
} catch (Exception e) { |
|
|
|
updateHis(outerApiHisDTO, e.getMessage(), false); |
|
|
|
fail +=1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
returnMap.put("message","批量选中:"+zs+"个重试记录,有效个数:"+actul+",重试成功个数:"+success+",重试失败个数:"+fail); |
|
|
|