自动化立体仓库 - WMS系统
1
ZY
2024-09-26 ddb9678030a8391fe63e6eb0775a77d12f1023ca
1
4个文件已修改
193 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MobileController.java 162 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/PlaController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/properties/SlaveProperties.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -31,7 +31,7 @@
 */
@RestController
@RequestMapping("mobile")
public class MobileController extends BaseController  {
public class MobileController extends BaseController {
    @Autowired
    private MobileService mobileService;
@@ -66,18 +66,18 @@
    // 商品上架
    @RequestMapping("/mat/onSale/auth")
    @ManagerAuth
    public R matOnSale(@RequestBody CombParam combParam){
    public R matOnSale(@RequestBody CombParam combParam) {
        mobileService.onSale(combParam);
        return R.ok("上架成功");
    }
    // 商品下架
    @RequestMapping("/mat/offSale/auth")
    //@ManagerAuth
    public R matOffSale(@RequestBody OffSaleParam offSaleParam){
    public R matOffSale(@RequestBody OffSaleParam offSaleParam) {
        mobileService.offSale(offSaleParam);
        return R.ok("下架成功");
    }
    // 组托 ----------------------------------------------------------------------------------------------------
@@ -88,7 +88,7 @@
     */
    @RequestMapping("/order/search/orderNo/auth")
    @ManagerAuth
    public R orderSearchByBarcode(@RequestParam String orderNo){
    public R orderSearchByBarcode(@RequestParam String orderNo) {
        Order order = orderService.selectByNo(orderNo);
        if (order == null) {
            return R.ok();
@@ -102,10 +102,10 @@
        }
        List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId());
        ArrayList<OrderDetl> orderDetls2 = new ArrayList<>();
        for (OrderDetl orderDetl : orderDetls){
            orderDetl.setAnfme(new BigDecimal(orderDetl.getAnfme()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
            orderDetl.setWorkQty(new BigDecimal(orderDetl.getWorkQty()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
            orderDetl.setQty(new BigDecimal(orderDetl.getQty()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
        for (OrderDetl orderDetl : orderDetls) {
            orderDetl.setAnfme(new BigDecimal(orderDetl.getAnfme()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            orderDetl.setWorkQty(new BigDecimal(orderDetl.getWorkQty()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            orderDetl.setQty(new BigDecimal(orderDetl.getQty()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            orderDetls2.add(orderDetl);
        }
        if (Cools.isEmpty(orderDetls) || Cools.isEmpty(orderDetls2)) {
@@ -116,14 +116,14 @@
    @RequestMapping("/comb/auth")
    @ManagerAuth(memo = "组托")
    public R comb(@RequestBody CombParam combParam){
    public R comb(@RequestBody CombParam combParam) {
        mobileService.comb(combParam, getUserId());
        return R.ok("组托成功");
    }
    @RequestMapping("/pack/get/auth")
    @ManagerAuth
    public R packGet(@RequestParam String barcode){
    public R packGet(@RequestParam String barcode) {
        Pack pack = packService.selectByBarcode(barcode);
        if (pack == null) {
            return R.ok();
@@ -136,7 +136,7 @@
    @RequestMapping("/pack/comb/auth")
    @ManagerAuth(memo = "下线组托")
    public R packComb(@RequestBody CombParam combParam){
    public R packComb(@RequestBody CombParam combParam) {
//        mobileService.packComb(combParam, getUserId());
        return R.ok("组托成功");
    }
@@ -149,7 +149,7 @@
    @Deprecated
    public R pakoutQuery(@RequestParam(required = false) String barcode,
                         @RequestParam(required = false) Integer staNo,
                         @RequestParam(required = false) String matnr){
                         @RequestParam(required = false) String matnr) {
        if (Cools.isEmpty(barcode) && Cools.isEmpty(matnr)) {
            return R.ok();
        }
@@ -173,7 +173,7 @@
     */
    @RequestMapping("/pakout/confirm/barcode/auth")
    @ManagerAuth
    public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode){
    public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode) {
        if (Cools.isEmpty(barcode)) {
            return R.ok();
        }
@@ -190,7 +190,7 @@
    // 根据库位码和商品码搜索商品
    @RequestMapping("/mat/find/auth")
    public R find(@RequestParam(required = false) String locNo
            , @RequestParam(required = false) String matnr){
            , @RequestParam(required = false) String matnr) {
        //List<ManLocDetl> manLocDetls = manLocDetlMapper.selectItem0(locNo, matnr);
        ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(locNo, matnr);
        return R.ok(manLocDetl);
@@ -203,7 +203,7 @@
    @RequestMapping("/pakout/confirm/pick/auth")
    @ManagerAuth
    public R pakoutQueryByBarcode(@RequestParam(required = false) Integer wrkNo
                                , @RequestParam(required = false) String matnr){
            , @RequestParam(required = false) String matnr) {
        if (Cools.isEmpty(wrkNo)) {
            return R.ok();
        }
@@ -338,14 +338,14 @@
    @RequestMapping("/adjust/auth")
    @ManagerAuth(memo = "盘点")
    public R adjust(@RequestBody MobileAdjustParam combParam){
    public R adjust(@RequestBody MobileAdjustParam combParam) {
        mobileService.adjust(combParam, getUserId());
        return R.ok("盘点成功");
    }
    @RequestMapping("/adjustNew/auth")
    @ManagerAuth(memo = "pda盘点")
    public R adjustNew(@RequestBody MobileAdjustNewParam combParam){
    public R adjustNew(@RequestBody MobileAdjustNewParam combParam) {
        mobileService.adjustNew(combParam, getUserId());
        return R.ok("盘点成功");
    }
@@ -353,18 +353,18 @@
    @PostMapping("/order/out/pakout/auth")
    @ManagerAuth(memo = "订单出库")
    public synchronized R pakoutByOrder(@RequestBody JSONObject param) {
        if(!param.containsKey("staNo") || !param.containsKey("orderNo")){
        if (!param.containsKey("staNo") || !param.containsKey("orderNo")) {
            return R.parse(BaseRes.PARAM);
        }
        mobileService.pakoutByOrder(param,getUserId());
        mobileService.pakoutByOrder(param, getUserId());
        return R.ok("出库成功");
    }
    //平库pda上架
    @RequestMapping("/manDetl/in")
    @ManagerAuth(memo = "订单上架")
    public R manDetlAdd(@RequestBody JSONObject json){
        if (json == null){
    public R manDetlAdd(@RequestBody JSONObject json) {
        if (json == null) {
            return R.error("传入数据为空");
        }
        return mobileService.manDetlIn(json, getUser());
@@ -373,38 +373,38 @@
    //平库pda下架
    @RequestMapping("/manDetl/out")
    @ManagerAuth(memo = "订单下架")
    public R manDetlDelete(@RequestBody JSONObject json){
        if (json == null){
    public R manDetlDelete(@RequestBody JSONObject json) {
        if (json == null) {
            return R.error("传入数据为空");
        }
        return mobileService.manDetlOut(json , getUser());
        return mobileService.manDetlOut(json, getUser());
    }
    @RequestMapping("/manDetl/in/barcode")
    @ManagerAuth(memo = "订单上架(托盘码)")
    public R manDetlAddbarcode(@RequestBody JSONObject json){
        if (json == null){
    public R manDetlAddbarcode(@RequestBody JSONObject json) {
        if (json == null) {
            return R.error("传入数据为空");
        }
        return mobileService.manDetlInBarcode(json,getUser());
        return mobileService.manDetlInBarcode(json, getUser());
    }
    @RequestMapping("/manDetl/in/origin")
    @ManagerAuth(memo = "平库上架")
    public R manDetlIn(@RequestBody JSONObject json){
        if (json == null){
    public R manDetlIn(@RequestBody JSONObject json) {
        if (json == null) {
            return R.error("传入数据为空");
        }
        return mobileService.manDetlOrigin(json,getUser());
        return mobileService.manDetlOrigin(json, getUser());
    }
    @RequestMapping("/manDetl/in/no/origin")
    @ManagerAuth(memo = "平库上架")
    public R manDetlInNo(@RequestBody JSONObject json){
        if (json == null){
    public R manDetlInNo(@RequestBody JSONObject json) {
        if (json == null) {
            return R.error("传入数据为空");
        }
        return mobileService.manDetlOrigInNo(json,getUser());
        return mobileService.manDetlOrigInNo(json, getUser());
    }
//    @RequestMapping("/manDetl/out/origin")
@@ -418,11 +418,11 @@
    @RequestMapping("/manDetl/out/origin")
    @ManagerAuth(memo = "平库下架")
    public R manDetlout2(@RequestBody JSONObject json){
        if (json == null){
    public R manDetlout2(@RequestBody JSONObject json) {
        if (json == null) {
            return R.error("传入数据为空");
        }
        return mobileService.manDetlOriginOut(json,getUser());
        return mobileService.manDetlOriginOut(json, getUser());
    }
//    @RequestMapping("/plaDetl/packin/v1")
@@ -456,28 +456,32 @@
//    }
    @RequestMapping("/plaDetl/packin/v1")
    @ManagerAuth(memo="pla入库")
    @ManagerAuth(memo = "pla入库")
    @Transactional
    public R plaPackInTestErp(@RequestBody JSONObject json) throws ParseException {
        String locNo = json.get("locNo").toString();
        JSONArray jsonArray = JSONArray.parseArray(json.getJSONArray("pla").toJSONString());
        for (Object o : jsonArray){
            JSONObject jsonObject = (JSONObject)o;
        //判断此次入库是否达到库存上限
        if (!mobileService.checkMaximum(locNo, jsonArray.size())) {
            return R.error("当前入库包数已超过库存上限");
        }
        for (Object o : jsonArray) {
            JSONObject jsonObject = (JSONObject) o;
            String brand = jsonObject.get("brand").toString();
            String batch = jsonObject.get("batch").toString();
            Integer packageNo = Integer.parseInt(jsonObject.get("packageNo").toString());
            if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){
            if (Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)) {
                return R.error("有参数为空,无法入库");
            }
            //测试
            if(false){
            if (false) {
                User user = new User();
                user.setUsername("test");
                mobileService.plaPakin(brand,locNo,batch,packageNo,user);
                json.put("user",user.getUsername());
            }else {
                mobileService.plaPakin(brand,locNo,batch,packageNo,getUser());
                json.put("user",getUser().getUsername());
                mobileService.plaPakin(brand, locNo, batch, packageNo, user);
                json.put("user", user.getUsername());
            } else {
                mobileService.plaPakin(brand, locNo, batch, packageNo, getUser());
                json.put("user", getUser().getUsername());
            }
        }
        //入库成功后上报ERP
@@ -487,7 +491,7 @@
    @RequestMapping("/plaDetl/packout1/v1")
//    @ManagerAuth(memo="pla出库")
    public R plaPackOut1(@RequestBody JSONObject json){
    public R plaPackOut1(@RequestBody JSONObject json) {
        String locNo = json.get("locNo").toString();
        String brand = json.get("brand").toString();
        String batch = json.get("batch").toString();
@@ -496,19 +500,19 @@
        String orderDetlId = json.get("orderDetlId").toString();
        String wrkNo = json.get("wrkNo").toString();
        Double anfme = Double.parseDouble(json.get("anfme").toString());
        boolean isReplace = Cools.eq(json.get("replace").toString(),"y");
        boolean isReplace = Cools.eq(json.get("replace").toString(), "y");
        if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){
        if (Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)) {
            return R.error("有参数为空,无法入库");
        }
        mobileService.plaPakout(brand,locNo,batch,packageNo,orderNo,orderDetlId,wrkNo,anfme,isReplace);
        mobileService.plaPakout(brand, locNo, batch, packageNo, orderNo, orderDetlId, wrkNo, anfme, isReplace);
        return R.ok();
    }
    @RequestMapping("/plaDetl/packout/v1")
//    @ManagerAuth(memo="pla出库")
    public R plaPackOut(@RequestBody JSONObject json){
    public R plaPackOut(@RequestBody JSONObject json) {
        String locNo = json.get("locNo").toString();
        String brand = json.get("brand").toString();
        String batch = json.get("batch").toString();
@@ -517,13 +521,13 @@
        String plaQtyId = json.get("orderDetlId").toString();
        String wrkNo = json.get("wrkNo").toString();
        Double anfme = Double.parseDouble(json.get("anfme").toString());
        boolean isReplace = !Cools.isEmpty(json.get("replace")) && Cools.eq(json.get("replace").toString(),"y");
        boolean isReplace = !Cools.isEmpty(json.get("replace")) && Cools.eq(json.get("replace").toString(), "y");
        if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){
        if (Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)) {
            return R.error("有参数为空,无法入库");
        }
        mobileService.plaPakout(brand,locNo,batch,packageNo,orderNo,plaQtyId,wrkNo,anfme,isReplace);
        mobileService.plaPakout(brand, locNo, batch, packageNo, orderNo, plaQtyId, wrkNo, anfme, isReplace);
        return R.ok();
    }
@@ -532,10 +536,10 @@
     */
    @RequestMapping("/plaDetl/packout/noOrder/v1")
    //@ManagerAuth(memo="pla手动出库")
    public R plaPackOutWithoutOrder(@RequestBody List<PlaParam> params){
    public R plaPackOutWithoutOrder(@RequestBody List<PlaParam> params) {
        for (PlaParam param : params){
            mobileService.plaPackOutWithoutOrder(param.getBrand(),param.getBatch(),param.getPackageNo(),param.getAnfme());
        for (PlaParam param : params) {
            mobileService.plaPackOutWithoutOrder(param.getBrand(), param.getBatch(), param.getPackageNo(), param.getAnfme());
        }
        return R.ok();
@@ -543,21 +547,21 @@
    @RequestMapping("/plaDetl/check/v1")
    public R plaDetlCheck(@RequestBody JSONObject json){
    public R plaDetlCheck(@RequestBody JSONObject json) {
        String brand = json.get("brand").toString();
        String batch = json.get("batch").toString();
        Integer packageNo = Integer.parseInt(json.get("packageNo").toString());
        Integer type = Integer.parseInt(json.get("type").toString());
        if(Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){
        if (Cools.isEmpty(batch) || Cools.isEmpty(packageNo)) {
            return R.error("有参数为空,无法入库");
        }
        Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo,brand);
        if ((Cools.isEmpty(pla))){
        Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo, brand);
        if ((Cools.isEmpty(pla))) {
            return R.error("该包物料未录入,无法查询到相关信息").add(pla);
        }
        if(!(Cools.eq(pla.getStatus(), GlobleParameter.PLA_STATUS_0) || Cools.eq(pla.getStatus(), GlobleParameter.PLA_STATUS_00)) && type != 2){
            return R.error("该包物料的状态为" + pla.getStatus() +",无法进行入库操作").add(pla);
        if (!(Cools.eq(pla.getStatus(), GlobleParameter.PLA_STATUS_0) || Cools.eq(pla.getStatus(), GlobleParameter.PLA_STATUS_00)) && type != 2) {
            return R.error("该包物料的状态为" + pla.getStatus() + ",无法进行入库操作").add(pla);
        }
        return R.ok(pla);
    }
@@ -567,18 +571,18 @@
     */
    @RequestMapping("/plaDetl/move/v1")
    @ManagerAuth
    public R plaDetlMove(@RequestBody PlaMoveParam param){
    public R plaDetlMove(@RequestBody PlaMoveParam param) {
        String locNo = param.getLocNo();
        Node node = nodeService.selectByUuid(locNo);
        if(Cools.isEmpty(node)){
        if (Cools.isEmpty(node)) {
            throw new CoolException("库位信息不正确");
        }
        List<PlaMoveParam.PlaMove> plas = param.getPlas();
        //判断此次入库是否达到库存上限
        if(!mobileService.checkMaximum(locNo,plas.size())){
        if (!mobileService.checkMaximum(locNo, plas.size())) {
            return R.error("当前入库包数已超过库存上限");
        }
@@ -586,15 +590,15 @@
            String brand = p.getBrand();
            String batch = p.getBatch();
            Integer packageNo = p.getPackageNo();
            if(Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){
            if (Cools.isEmpty(batch) || Cools.isEmpty(packageNo)) {
                throw new CoolException("有参数为空,无法入库");
            }
            Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo,brand);
            if ((Cools.isEmpty(pla))){
            Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo, brand);
            if ((Cools.isEmpty(pla))) {
                throw new CoolException("该包物料未录入,无法查询到相关信息");
            }
            if(!Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_1) && !Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_3)){
                throw new CoolException("该包物料的状态为" + pla.getStatus() +",无法进行入库操作");
            if (!Cools.eq(pla.getStatus(), GlobleParameter.PLA_STATUS_1) && !Cools.eq(pla.getStatus(), GlobleParameter.PLA_STATUS_3)) {
                throw new CoolException("该包物料的状态为" + pla.getStatus() + ",无法进行入库操作");
            }
            String sourceLocNo = pla.getLocNo();
@@ -603,8 +607,8 @@
            pla.setModifyTime(new Date());
            plaService.updateById(pla);
            SaasUtils.insertLog(2,sourceLocNo,pla.getBrand(),pla.getWeightAnfme(),getUser().getUsername(),
                    locNo,pla.getBatch(),pla.getPackageNo(),pla.getOwner(),pla.getWorkshop(),null);
            SaasUtils.insertLog(2, sourceLocNo, pla.getBrand(), pla.getWeightAnfme(), getUser().getUsername(),
                    locNo, pla.getBatch(), pla.getPackageNo(), pla.getOwner(), pla.getWorkshop(), null);
        });
@@ -615,7 +619,7 @@
    根据拣货单出库 ------> 获取拣货单
     */
    @RequestMapping("/manpakout/check/v1")
    public R getManPakout (@RequestBody JSONObject json){
    public R getManPakout(@RequestBody JSONObject json) {
        String orderNo = json.get("orderNo").toString();
@@ -623,19 +627,19 @@
    }
    @RequestMapping("/manpakout/pakout/v1")
    public R pakout(@RequestBody JSONObject json){
    public R pakout(@RequestBody JSONObject json) {
        String batch = json.get("batch").toString();
        Integer packageNo = Integer.parseInt(json.get("packageNo").toString());
        String orderNo = json.get("orderNo").toString();
        return R.ok();
    }
    @RequestMapping("select/mat/information/v1")
    @ManagerAuth
    public R pdaSelectInformation(@RequestParam String barcode){
    public R pdaSelectInformation(@RequestParam String barcode) {
        List<Pla> locDetls = mobileService.pdaSelectInfmt(barcode);
        return R.ok(locDetls);
    }
@@ -650,7 +654,7 @@
//        System.out.println(jsonObject);
        String s = "2024010502";
        System.out.println(s.substring(8,10));
        System.out.println(s.substring(8, 10));
        Object s1 = "8";
        System.out.println(Integer.parseInt(s1.toString()));
src/main/java/com/zy/asrs/controller/PlaController.java
@@ -11,7 +11,6 @@
import com.core.common.R;
import com.core.common.SnowflakeIdWorker;
import com.core.exception.CoolException;
import com.microsoft.sqlserver.jdbc.SQLServerException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.GlobleParameter;
import com.zy.asrs.entity.result.KeyValueVo;
@@ -366,9 +365,14 @@
                .andNew().like("batch", condition)
                .groupBy("batch")
                .orderBy("batch", false);
        List<Pla> plas = plaService.selectPage(new Page<Pla>(1, 30), wrapper).getRecords();
        Page<Pla> plaPage = new Page<>(1, 30);
        plaPage.setSearchCount(false);
        Page<Pla> plaPage1 = plaService.selectPage(plaPage, wrapper);
        // 重新查询然后给page设置Total
        plaPage.setTotal(this.plaService.selectCount(new EntityWrapper<Pla>().setSqlSelect("batch")
                .andNew().like("batch", condition)));
        List<KeyValueVo> valueVos = new ArrayList<>();
        for (Pla pla : plas) {
        for (Pla pla : plaPage1.getRecords()) {
            KeyValueVo vo = new KeyValueVo();
            vo.setName(pla.getBatch());
            vo.setValue(pla.getBatch());
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -620,10 +620,10 @@
            }
        }
        for (OpenOrderPakoutParam param : list) {
            doHttpRequest(param, "入库单上报", url, orderReportPath, null, "127.0.0.1");
        //for (OpenOrderPakoutParam param : list) {
            doHttpRequest(list, "入库单上报", url, orderReportPath, null, "127.0.0.1");
        }
        //}
        return 200;
@@ -697,19 +697,15 @@
                    .build()
                    .doPost();
            log.info("入库单上报请求返回报文:{}", response);
            response = response.replace("\\", "");
            response = response.substring(1, response.length() - 1);
            JSONObject jsonObject = JSON.parseObject(response);
            JSONArray jsonArray = (JSONArray) jsonObject.get("");
            JSONObject jsonResult = (JSONObject) jsonArray.get(0);
            if (Cools.isEmpty(jsonResult.get("ErrorCode"))) {
                throw new CoolException(jsonResult.get("ErrorMsg").toString());
            if (Cools.isEmpty(jsonObject.get("ErrorCode"))) {
                throw new CoolException(jsonObject.get("ErrorMsg").toString());
            }
            int code = Integer.parseInt(jsonResult.get("ErrorCode").toString());
            if (code != 1) {
                throw new CoolException(jsonResult.get("ErrorMsg").toString());
            int code = Integer.parseInt(jsonObject.get("ErrorCode").toString());
            if (code != 0) {
                throw new CoolException(jsonObject.get("ErrorMsg").toString());
            }
            success = true;
            return code;
src/main/java/com/zy/common/properties/SlaveProperties.java
@@ -16,7 +16,6 @@
public class SlaveProperties {
    private boolean doubleDeep;
    private List<Integer> doubleLocs = new ArrayList<>();
    private int groupCount;