|
@@ -1,8 +1,24 @@
|
|
|
package com.ruoyi.ams.xuankuang.service;
|
|
|
|
|
|
+import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
|
|
|
+import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
|
|
|
import com.ruoyi.ams.asn.service.IWmsDocAsnDetailsService;
|
|
|
import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
|
|
|
+import com.ruoyi.ams.xuankuang.domain.form.BillTaskForm;
|
|
|
+import com.ruoyi.ams.xuankuang.domain.vo.WcsResponseVo;
|
|
|
+import com.ruoyi.base.constant.Constant;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 入库业务
|
|
@@ -11,6 +27,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
* @version 1.0
|
|
|
* @date 2023/3/30 10:51
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
public class WmsDocAsnSubService {
|
|
|
|
|
|
@Autowired
|
|
@@ -19,6 +37,45 @@ public class WmsDocAsnSubService {
|
|
|
private IWmsDocAsnDetailsService iWmsDocAsnDetailsService;
|
|
|
|
|
|
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult queryDocAsnDetails(@PathVariable("asnNo") String asnNo) {
|
|
|
+ // 根据单号,和创建状态为00
|
|
|
+ WmsDocAsnDetails wmsDocAsnDetails = new WmsDocAsnDetails();
|
|
|
+ wmsDocAsnDetails.setAsnNo(asnNo);
|
|
|
+ wmsDocAsnDetails.setLineStatus(Constant.ASN_STS.STS00.getValue());
|
|
|
+ List<WmsDocAsnDetails> list = iWmsDocAsnDetailsService.selectWmsDocAsnDetailsList(wmsDocAsnDetails);
|
|
|
+
|
|
|
+ WmsDocAsnHeader wmsDocAsnHeader = iWmsDocAsnHeaderService.selectWmsDocAsnHeaderByAsnNo(asnNo);
|
|
|
+ boolean con = true;
|
|
|
+ for (WmsDocAsnDetails details:list) {
|
|
|
+ BillTaskForm billTaskForm = new BillTaskForm();
|
|
|
+ billTaskForm.setDocNo(details.getAsnNo());
|
|
|
+ billTaskForm.setTaskNo(details.getAsnLineNo().toString());
|
|
|
+ if (details.getDesc2()!=5){
|
|
|
+ billTaskForm.setPackageType(1);
|
|
|
+ }
|
|
|
+ billTaskForm.setType(Constant.ASN_TYP.getByValue(wmsDocAsnHeader.getAsnType()).getValue1());
|
|
|
+ billTaskForm.setNum(details.getExpectedQty().intValue());
|
|
|
+// billTaskForm.setDest(Constant.PRODUCTION_LINE_SITE.getByValue());
|
|
|
+ billTaskForm.setMaterial(details.getDesc2());
|
|
|
+ WmsToWcsApiService wmsToWcsApiService = new WmsToWcsApiService();
|
|
|
+ WcsResponseVo wcsResponseVo = wmsToWcsApiService.wmsBillTask(billTaskForm);
|
|
|
+ if (!wcsResponseVo.isSuccess()) {
|
|
|
+ con = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 修改 明细行状态为10
|
|
|
+ details.setLineStatus(Constant.ASN_STS.STS10.getValue());
|
|
|
+ iWmsDocAsnDetailsService.updateWmsDocAsnDetails(details);
|
|
|
+ }
|
|
|
+ if (con == true) {
|
|
|
+ // 修改 单头10
|
|
|
+ wmsDocAsnHeader.setAsnStatus(Constant.ASN_STS.STS10.getValue());
|
|
|
+ iWmsDocAsnHeaderService.updateWmsDocAsnHeader(wmsDocAsnHeader);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("", list);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|