自动化立体仓库 - WMS系统
野心家
3 天以前 c14c261181c9afb2e0d07c714e06c81a6417c8cd
对接mes物料信息
6个文件已修改
157 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MatController.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/Mat.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/locDetl/locDetl.js 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MatController.java
@@ -2,6 +2,7 @@
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -10,20 +11,21 @@
import com.core.annotations.ManagerAuth;
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.MatPrint;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.EmptyPlateOutParam;
import com.zy.asrs.entity.result.KeyValueVo;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.utils.MatExcelListener;
import com.zy.common.CodeRes;
import com.zy.common.config.AdminInterceptor;
import com.zy.common.entity.MatExcel;
import com.zy.common.utils.BarcodeUtils;
import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.QrCode;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -42,6 +44,12 @@
    private MatService matService;
    @Autowired
    private SnowflakeIdWorker snowflakeIdWorker;
    @Value("${mes.address.url}")
    private String url;
    @Value("${mes.address.cxaddress}")
    private String cxaddress;
    @Autowired
    private ApiLogService apiLogService;
    @RequestMapping(value = "/mat/auto/matnr/auth")
    public R autoMatnr(){
@@ -80,7 +88,92 @@
    @RequestMapping(value = "/mat/auth")
    @ManagerAuth
    public R find(@RequestParam("matnr") String matnr) {
        return R.ok(matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr)));
        Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr));
        if(Cools.isEmpty(mat)){
            LinkedHashMap<String,Object> map = new LinkedHashMap<>();
            LinkedHashMap<String,Object> YongHuCanShu=new LinkedHashMap<>();
            YongHuCanShu.put("QianMingId","");
            map.put("YongHuCanShu",YongHuCanShu);
            LinkedHashMap<String,Object> QiTaCanShu=new LinkedHashMap<>();
            QiTaCanShu.put("GnBm","bopp_TM302D12");
            QiTaCanShu.put("pagesize",50);
            QiTaCanShu.put("pageindex",1);
            QiTaCanShu.put("Operation","1");
            List<LinkedHashMap<String,Object>> XhJiHes=new ArrayList<>();
            LinkedHashMap<String,Object> XhJiHe=new LinkedHashMap<>();
            XhJiHe.put("Xh1","1");
            XhJiHe.put("Xh2",2);
            XhJiHes.add(XhJiHe);
            QiTaCanShu.put("XhJiHe",XhJiHes);
            QiTaCanShu.put("条件一"," and t1.tm_xj like ##"+"%"+matnr+"%"+"##");
            map.put("QiTaCanShu",QiTaCanShu);
            HashMap<String,Object>hashMap=new HashMap<String,Object>();
            hashMap.put("Quanjucanshu","%7B%22XiTongCanShu%22%3A%7B%22xt_id%22%3A%2230077%22%2C%22xt_bm%22%3A%22undefined%22%2C%22xt_yhid%22%3A%22156%22%2C%22xt_yhms%22%3A%22%E7%B3%BB%E7%BB%9F%E7%AE%A1%E7%90%86%E5%91%98%22%2C%22xt_yhbm%22%3A%22admin%22%2C%22xt_qyms%22%3A%221%22%2C%22xt_qyjc%22%3A%221%22%2C%22xt_jsms%22%3A%22%E7%AE%A1%E7%90%86%E5%91%98%22%2C%22xt_yuyan%22%3A%22%22%7D%2C%22NeiBuCanShu%22%3A%7B%7D%7D");
            String jsonString = JSON.toJSONString(map);
            HashMap<String,Object>CanShuJi=new HashMap<String,Object>();
            CanShuJi.put("CanShuJi",jsonString);
            System.out.println(JSON.toJSONString(CanShuJi));
            String response = "";
            boolean success = false;
            try {
                response = new HttpHandler.Builder()
                        .setHeaders(hashMap)
                        .setUri(url)
                        .setPath(cxaddress)
                        .setParams(CanShuJi)
                        .build()
                        .doPost();
                JSONObject jsonObject = JSON.parseObject(response);
                if (jsonObject.getString("BianHao").equals("0000")) {
                    Object jieGuo = jsonObject.get("JieGuo");
                    JSONObject jsonString1 = JSON.parseObject(jieGuo.toString());
                    JSONObject jsonString2 = JSON.parseObject(jsonString1.get("peizhidingyicanshu").toString());
                    JSONArray sqlyujujg = JSON.parseArray(jsonString2.get("sqlyujujg").toString());
                    JSONObject jsonString3 = JSON.parseObject(sqlyujujg.get(0).toString());
                    //添加物料档案
                    Mat mat1=new Mat();
                    mat1.setMatnr(jsonString3.getString("生产批号"));
                    mat1.setMaktx(jsonString3.getString("产品名称"));
                    mat1.setSpecs(jsonString3.getString("产品规格"));
                    mat1.setUnit(jsonString3.getString("单位"));
                    mat1.setModel(jsonString3.getString("制单人"));
                    mat1.setColor(jsonString3.getString("状态"));
                    mat1.setPrice(jsonString3.getDouble("生产数量"));
                    mat1.setSku(jsonString3.getString("生产批号"));
                    mat1.setOrigin(jsonString3.getString("胶量"));
                    mat1.setBarcode(jsonString3.getString("条码"));
                    mat1.setManu(jsonString3.getString("质量状态"));
                    matService.insert(mat1);
                    mat=mat1;
                    success=true;
                } else {
                    throw new CoolException("wms请求mes查询物料信息失败");
                }
            } catch (Exception e) {
                return R.error(e.getMessage());
            } finally {
                try {
                    // 保存接口日志
                    apiLogService.save(
                            "wms请求mes查询物料信息",
                            url+"/"+cxaddress,
                            null,
                            "127.0.0.1",
                            JSON.toJSONString(map),
                            response,
                            success
                    );
                } catch (Exception e) {
                    R.error(e.toString());
                }
            }
        }
        return R.ok(mat);
    }
    @RequestMapping(value = "/mat/list/auth")
src/main/java/com/zy/asrs/entity/Mat.java
@@ -88,15 +88,15 @@
    /**
     * 型号
     */
    @ApiModelProperty(value= "型号")
    @ExcelProperty(value = "型号")
    @ApiModelProperty(value= "制单人")
    @ExcelProperty(value = "制单人")
    private String model;
    /**
     * 颜色
     */
    @ApiModelProperty(value= "颜色")
    @ExcelProperty(value = "颜色")
    @ApiModelProperty(value= "状态")
    @ExcelProperty(value = "状态")
    private String color;
    /**
@@ -116,15 +116,15 @@
    /**
     * 单价
     */
    @ApiModelProperty(value= "单价")
    @ExcelProperty(value = "单价")
    @ApiModelProperty(value= "生产数量")
    @ExcelProperty(value = "生产数量")
    private Double price;
    /**
     * sku
     */
    @ApiModelProperty(value= "sku")
    @ExcelProperty(value = "sku")
    @ApiModelProperty(value= "生产批号")
    @ExcelProperty(value = "生产批号")
    private String sku;
    /**
@@ -144,15 +144,15 @@
    /**
     * 产地
     */
    @ApiModelProperty(value= "产地")
    @ExcelProperty(value = "产地")
    @ApiModelProperty(value= "胶量")
    @ExcelProperty(value = "胶量")
    private String origin;
    /**
     * 厂家
     */
    @ApiModelProperty(value= "厂家")
    @ExcelProperty(value = "厂家")
    @ApiModelProperty(value= "质量状态")
    @ExcelProperty(value = "质量状态")
    private String manu;
    /**
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -100,6 +100,11 @@
        if (param.getCombMats().size()>1){
            throw new CoolException("不允许混料===>>" + param.getBarcode());
        }
        Mat mat1 = matService.selectByMatnr(param.getCombMats().get(0).getMatnr());
        if(!Cools.isEmpty(mat1)){
            param.getCombMats().get(0).setBatch(mat1.getMatnr());
            param.getCombMats().get(0).setAnfme(mat1.getPrice());
        }
        if(Cools.isEmpty(param.getCombMats().get(0).getBatch())){
            throw new CoolException("批号(唯一码)不能为空===>>" + param.getBarcode());
        }
src/main/resources/application.yml
@@ -90,6 +90,7 @@
  address:
    url: http://220.189.244.250:10082
    outaddressSave: hmxtapi/Yh_SP/TiJiaoShuJu_AnNui
    cxaddress: hmxtapi/Yh_SP/d12_0102
#erp对接
src/main/webapp/static/js/common.js
@@ -225,21 +225,21 @@
    {field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true}
    ,{field: 'maktx', align: 'center',title: '商品名称(品名)', sort:true}
    ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false}
    ,{field: 'batch', align: 'center',title: '货品特征', sort:true}
    ,{field: 'anfme', align: 'center',title: '数量', hide: false}
    ,{field: 'batch', align: 'center',title: '生产批号', sort:true}
    ,{field: 'anfme', align: 'center',title: '生产数量', hide: false}
    ,{field: 'zpallet', align: 'center',title: '托盘条码', hide: false}
    ,{field: 'specs', align: 'center',title: '规格', hide: false}
    ,{field: 'model', align: 'center',title: '代码', hide: true}
    ,{field: 'color', align: 'center',title: '颜色', hide: true}
    ,{field: 'specs', align: 'center',title: '产品规格', hide: false}
    ,{field: 'model', align: 'center',title: '制单人', hide: false}
    ,{field: 'color', align: 'center',title: '状态', hide: false}
    ,{field: 'brand', align: 'center',title: '品牌', hide: true}
    ,{field: 'unit', align: 'center',title: '单位', hide: false}
    ,{field: 'price', align: 'center',title: '单价', hide: true}
    ,{field: 'sku', align: 'center',title: 'sku', hide: true}
    ,{field: 'units', align: 'center',title: '单位量', hide: true}
    ,{field: 'barcode', align: 'center',title: '条码', hide: true}
    ,{field: 'origin', align: 'center',title: '产地', hide: true}
    ,{field: 'manu', align: 'center',title: '厂家', hide: true}
    ,{field: 'origin', align: 'center',title: '胶量', hide: false}
    ,{field: 'manu', align: 'center',title: '质量状态', hide: false}
    ,{field: 'manuDate', align: 'center',title: '生产日期', hide: true}
    ,{field: 'itemNum', align: 'center',title: '品项数', hide: true}
    ,{field: 'safeQty', align: 'center',title: '安全库存量', hide: true}
src/main/webapp/static/js/locDetl/locDetl.js
@@ -9,17 +9,17 @@
        ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true}
        ,{field: 'anfme', align: 'center',title: '数量'}
        ,{field: 'zpallet', align: 'center',title: '托盘条码'}
        ,{field: 'specs', align: 'center',title: '规格'}
        ,{field: 'model', align: 'center',title: '代码', hide: true}
        ,{field: 'color', align: 'center',title: '颜色', hide: true}
        ,{field: 'specs', align: 'center',title: '产品规格'}
        ,{field: 'model', align: 'center',title: '制单人', hide: false}
        ,{field: 'color', align: 'center',title: '状态', hide: false}
        ,{field: 'brand', align: 'center',title: '品牌', hide: true}
        ,{field: 'unit', align: 'center',title: '单位', hide: true}
        ,{field: 'unit', align: 'center',title: '单位', hide: false}
        ,{field: 'price', align: 'center',title: '单价', hide: true}
        ,{field: 'sku', align: 'center',title: 'sku', hide: true}
        ,{field: 'units', align: 'center',title: '单位量', hide: true}
        ,{field: 'barcode', align: 'center',title: '条码', hide: true}
        ,{field: 'origin', align: 'center',title: '产地', hide: true}
        ,{field: 'manu', align: 'center',title: '厂家', hide: true}
        ,{field: 'origin', align: 'center',title: '胶量', hide: false}
        ,{field: 'manu', align: 'center',title: '质量状态', hide: false}
        ,{field: 'manuDate', align: 'center',title: '生产日期', hide: true}
        ,{field: 'itemNum', align: 'center',title: '品项数', hide: true}
        ,{field: 'safeQty', align: 'center',title: '安全库存量', hide: true}