admin
2024-06-15 8cfe20288690f2ba46c804f41f39e8aa48c2dea0
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
@@ -17,7 +17,10 @@
import com.jcdm.main.om.productionOrde.mapper.OmProductionOrdeInfoMapper;
import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
import com.jcdm.main.restful.factoryMes.service.RestfulService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.loadtime.Aj;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -42,10 +45,13 @@
 * @author ruimin
 * @date 2023-12-11
 */
@Slf4j
@RestController
@RequestMapping("/om/productionOrde")
public class OmProductionOrdeInfoController extends BaseController
{
    private static final Logger logger = LoggerFactory.getLogger("sys-user");
    @Autowired
    private IOmProductionOrdeInfoService omProductionOrdeInfoService;
@@ -122,24 +128,26 @@
        String code = jsonObject.getStr("code");
        // 判断接单是否成功
        if(code.equals("success")){
            OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo();
            omProductionOrdeInfo.setWorkOrderNo(dataObject.getStr("productionOrderNum"));
            omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum"));
            omProductionOrdeInfo.setStationCode(dataObject.getStr("stationCode"));
            omProductionOrdeInfo.setMaterialCode(dataObject.getStr("materialCode"));
            if(dataObject.getStr("model").equals("PE01A")){
                omProductionOrdeInfo.setProductCode("1P102S");
            }else {
                omProductionOrdeInfo.setProductCode(dataObject.getStr("model"));
            logger.info("请求工厂MES工单:入参pack{}出参pack:{}",paramProductNum,dataObject.getStr("productNum"));
            List<OmProductionOrdeInfo> check = omProductionOrdeInfoService.list(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getProductNum,dataObject.getStr("productNum")));
            if(check.size() == 0){
                OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo();
                omProductionOrdeInfo.setWorkOrderNo(dataObject.getStr("productionOrderNum"));
                omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum"));
                omProductionOrdeInfo.setStationCode(dataObject.getStr("stationCode"));
                omProductionOrdeInfo.setMaterialCode(dataObject.getStr("materialCode"));
                if(dataObject.getStr("model").equals("PE01A")){
                    omProductionOrdeInfo.setProductCode("1P102S");
                }else {
                    omProductionOrdeInfo.setProductCode(dataObject.getStr("model"));
                }
                omProductionOrdeInfo.setCreateTime(new Date());
                omProductionOrdeInfo.setCreateUser("工厂MES");
                omProductionOrdeInfoService.save(omProductionOrdeInfo);
            }
            omProductionOrdeInfo.setCreateTime(new Date());
            omProductionOrdeInfo.setCreateUser("工厂MES");
            omProductionOrdeInfoService.save(omProductionOrdeInfo);
        }else {
            return AjaxResult.error("接单失败,请联系管理员");
        }
        return AjaxResult.success(dataObject.getStr("productNum"));
    }