mrzhssss
2021-12-15 26c094751ca84d2e54bf611b05111a44b406c115
增加log.info
2个文件已添加
1个文件已修改
239 ■■■■■ 已修改文件
src/main/java/com/zy/common/entity/InterData.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/WcsController.java 195 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/entity/InterData.java
New file
@@ -0,0 +1,32 @@
package com.zy.common.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class InterData {
    //1—原料,2—成品
    @ApiModelProperty(value= "材料类型")
    private Integer matType;
    //1—原料入库,2—成品入库,
    //3—成品出库
    @ApiModelProperty(value= "入出库类型")
    private Integer ioType;
    @ApiModelProperty(value= "单据ID")
    private Integer FInterID;
    @ApiModelProperty(value= "单据编号")
    private String FBillNo;
    @ApiModelProperty(value= "物料编码")
    private String Fnumber;
    //任务修改后的数量,如果为0表示取消
    @ApiModelProperty(value= "修改数量")
    private BigDecimal FQty;
}
src/main/java/com/zy/common/web/WcsController.java
New file
@@ -0,0 +1,195 @@
package com.zy.common.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.service.OutStockService;
import com.zy.asrs.service.WaitPakinService;
import com.zy.common.entity.InterData;
import com.zy.common.service.erp.entity.OutStockBillEntry;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.List;
/**
 * Created by vincent on 2020/10/30
 */
@Slf4j
@RestController
public class WcsController {
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private OutStockService outStockService;
    @PostMapping("/inout/cancel/auth/v1")
    @ResponseBody
    public JSON getLocNo(@RequestBody String param) throws Exception {
        log.info("ERP取消任务:"+ param);
        JSONObject jsonObject = JSONObject.parseObject(param);//将参数转化为JSON格式
        String inter = jsonObject.getString("data");
        List<InterData> list = JSONArray.parseArray(inter, InterData.class);//获取参数集合
        JSONObject jsonObject1 = new JSONObject();
        JSONArray jsonArray = new JSONArray();
        for (InterData interData : list) {
            //查询对应入库通知档信息
            Wrapper wrapper = new EntityWrapper<WaitPakin>().eq("supplier", interData.getFBillNo()).eq("matnr", interData.getFnumber());
            WaitPakin waitPakin = waitPakinService.selectOne(wrapper);
            if ((interData.getIoType() == 1 && interData.getMatType() == 1) || (interData.getIoType() == 2 && interData.getMatType() == 2)) {
                if (Cools.isEmpty(waitPakin)) {
                    JSONObject object = new JSONObject();
                    object.put("FInterID", interData.getFInterID());
                    object.put("Fnumber", interData.getFnumber());
                    object.put("code", 500);
                    object.put("msg", "单据不存在或单据已被删除");
                    jsonArray.add(object);
                    continue;
                }
                //判断是否有出库动作   "N"没有  “Y”有
                if (waitPakin.getIoStatus().equals("N")) {
                    //判断传入的数量是否为0来执行删除或者修改
                    if (interData.getFQty().compareTo(BigDecimal.ZERO) == 0) {
                        waitPakinService.delete(wrapper);
                        JSONObject object = new JSONObject();
                        object.put("Fnumber", interData.getFnumber());
                        object.put("FInterID", interData.getFInterID());
                        object.put("code", 200);
                        object.put("msg", "删除成功");
                        jsonArray.add(object);
                    } else {
                        waitPakin.setAnfme(interData.getFQty().doubleValue());
                        waitPakinService.update(waitPakin, wrapper);
                        JSONObject object = new JSONObject();
                        object.put("Fnumber", interData.getFnumber());
                        object.put("FInterID", interData.getFInterID());
                        object.put("code", 200);
                        object.put("msg", "修改成功");
                        jsonArray.add(object);
                    }
                } else {
                    JSONObject object = new JSONObject();
                    object.put("FInterID", interData.getFInterID());
                    object.put("Fnumber", interData.getFnumber());
                    object.put("code", 500);
                    object.put("msg", "已在入库中,无法取消");
                    jsonArray.add(object);
                }
            }
            if (interData.getIoType() == 3) {
                Wrapper wrapper1 = new EntityWrapper<OutStockBillEntry>().eq("FInterID", interData.getFInterID()).and().eq("Fnumber", interData.getFnumber());
                OutStockBillEntry outStockBillEntry = outStockService.selectOne(wrapper1);
                if (Cools.isEmpty(outStockBillEntry)) {
                    JSONObject object = new JSONObject();
                    object.put("FInterID", interData.getFInterID());
                    object.put("Fnumber", interData.getFnumber());
                    object.put("code", 500);
                    object.put("msg", "单据不存在或单据已被删除");
                    jsonArray.add(object);
                    continue;
                }
                //判断出库数量回传字段和出库数量字段是否为0
                if (outStockBillEntry.getFAuxCommitQty().compareTo(BigDecimal.ZERO) == 0 && outStockBillEntry.getFAmount().compareTo(BigDecimal.ZERO) == 0) {
                    //判断传入的数量是否为0来执行删除或者修改
                    if (interData.getFQty().compareTo(BigDecimal.ZERO) == 0) {
                        outStockService.delete(wrapper1);
                        JSONObject object = new JSONObject();
                        object.put("Fnumber", interData.getFnumber());
                        object.put("FInterID", interData.getFInterID());
                        object.put("code", 200);
                        object.put("msg", "删除成功");
                        jsonArray.add(object);
                    } else {
                        outStockBillEntry.setFAuxQty(interData.getFQty());
                        outStockService.update(outStockBillEntry, wrapper1);
                        JSONObject object = new JSONObject();
                        object.put("Fnumber", interData.getFnumber());
                        object.put("FInterID", interData.getFInterID());
                        object.put("code", 200);
                        object.put("msg", "修改成功");
                        jsonArray.add(object);
                    }
                } else {
                    if (outStockBillEntry.getFAuxCommitQty().compareTo(BigDecimal.ZERO) > 0) {
                        JSONObject object = new JSONObject();
                        object.put("Fnumber", interData.getFnumber());
                        object.put("FInterID", interData.getFInterID());
                        object.put("code", 500);
                        object.put("msg", "已在出库中,无法取消");
                        jsonArray.add(object);
                    }
                }
            }
            if (Cools.isEmpty(jsonArray)) {
                JSONObject object = new JSONObject();
                object.put("Fnumber", interData.getFnumber());
                object.put("FInterID", interData.getFInterID());
                object.put("code", 500);
                object.put("msg", "单据有错误,请核对");
                jsonArray.add(object);
            }
        }
        jsonObject1.put("data", jsonArray);
        return jsonObject1;
    }
//        if (Cools.isEmpty(param.getIoType())) {
//            return R.error("入出库类型不能为空");
//        }
//        if (Cools.isEmpty(param.getSourceStaNo())) {
//            return R.error("源站编号不能为空");
//        }
//        List<WaitPakin> waitPakins = new ArrayList<WaitPakin>();
//        if (param.getIoType() == 1) {
//            if (Cools.isEmpty(param.getBarcode())) {
//                return R.error("条码不能为空");
//            }
////            waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
////            if (Cools.isEmpty(waitPakins)) {
////                return R.error("条码数据错误");
////            }
//            int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode()));
//            int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode()));
//            if (countLoc > 0 || countWrk > 0) {
//                return R.error("工作档/库存条码数据已存在");
//            }
//        }
//        if (Cools.isEmpty(param.getLocType1())){
//            return R.error("高低检测信号不能为空");
//        }
//
//        LocTypeDto locTypeDto = new LocTypeDto();
//        locTypeDto.setLocType1(param.getLocType1());
//
//        StartupDto dto = null;
//        switch (param.getIoType()) {
//            case 1:
//                WaitPakin waitPakin = new WaitPakin();
//                waitPakin.setMatnr(param.getBarcode());
//                waitPakin.setAnfme(1D);
//                waitPakins.add(waitPakin);
//                dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, waitPakins);
//                break;
//            case 10:
//                dto = emptyPlateIn(param.getSourceStaNo(), locTypeDto);
//                break;
//            default:
//                break;
//        }
}
src/main/resources/application.yml
@@ -1,14 +1,14 @@
server:
  port: 8081
  servlet:
    context-path: /@pom.build.finalName@
    context-path: /xtywms
spring:
  application:
    name: @pom.build.finalName@
    name: xtywms
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
#    url: jdbc:sqlserver://192.168.4.208:1433;databasename=xtyasrs
    #    url: jdbc:sqlserver://192.168.4.208:1433;databasename=xtyasrs
    url: jdbc:sqlserver://localhost:1433;databasename=xtyasrs
    username: sa
    password: sa@123
@@ -18,7 +18,7 @@
    host: localhost
    port: 6379
    database: 0
#    password: xltys1995
  #    password: xltys1995
  servlet:
    multipart:
      maxFileSize: 100MB
@@ -34,7 +34,7 @@
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
  path: /stock/out/@pom.build.finalName@/logs
  path: /stock/out/xtywms/logs
super:
  pwd: xltys1995
@@ -46,7 +46,7 @@
  db:
    driver_class_name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    ur: jdbc:sqlserver://192.168.0.253:1433;databasename=xtyasrs_dual
#    ur: jdbc:sqlserver://192.168.4.208:1433;databasename=xtyasrs_dual
    #    ur: jdbc:sqlserver://192.168.4.208:1433;databasename=xtyasrs_dual
    username: sa
    password: sa@123