| src/main/java/com/zy/asrs/controller/HalfBarcodeController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/asrs/controller/ImagePreviewController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/asrs/mapper/HalfBarcodeMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/asrs/service/HalfBarcodeService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/asrs/service/impl/HalfBarcodeServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/resources/mapper/HalfBarcodeMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/webapp/views/halfBarcode/halfBarcode.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/controller/HalfBarcodeController.java
@@ -1,5 +1,7 @@ package com.zy.asrs.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.core.annotations.ManagerAuth; @@ -8,52 +10,100 @@ import com.core.common.R; import com.zy.asrs.entity.HalfBarcode; import com.zy.asrs.entity.MatBarcode; import com.zy.asrs.mapper.MatBarcodeMapper; import com.zy.asrs.service.HalfBarcodeService; import com.zy.asrs.service.MatBarcodeService; import com.zy.common.web.BaseController; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @RestController @RequestMapping public class HalfBarcodeController extends BaseController { @Autowired private HalfBarcodeService halfBarcodeService; @Autowired private MatBarcodeService matBarcodeService; /* * 物料托盘绑定分页查询 * */ // @RequestMapping(value = "/halfBarcode/list/auth") // @ManagerAuth // public R list(@RequestParam(defaultValue = "1")Integer curr, // @RequestParam(defaultValue = "10")Integer limit, // @RequestParam(required = false)String orderByField, // @RequestParam(required = false)String orderByType, // @RequestParam Map<String, Object> param) { // excludeTrash(param); // EntityWrapper<HalfBarcode> wrapper = new EntityWrapper<>(); // convert(param, wrapper); // if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} // else { // wrapper.orderBy("modi_time", false); // } // return R.ok(halfBarcodeService.selectPage(new Page<>(curr, limit), wrapper)); // } @RequestMapping(value = "/halfBarcode/list/auth") @ManagerAuth public R list(@RequestParam(defaultValue = "1")Integer curr, @RequestParam(defaultValue = "10")Integer limit, @RequestParam(required = false)String orderByField, @RequestParam(required = false)String orderByType, @RequestParam Map<String, Object> param) { // @ManagerAuth public R list2(@RequestParam(defaultValue = "1") Integer curr, @RequestParam(defaultValue = "10") Integer limit, @RequestParam(required = false) String orderByField, @RequestParam(required = false) String orderByType, @RequestParam Map<String, Object> param) { excludeTrash(param); EntityWrapper<HalfBarcode> wrapper = new EntityWrapper<>(); convert(param, wrapper); if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else { wrapper.orderBy("modi_time", false); HalfBarcode halfBarcode = JSONObject.parseObject(JSON.toJSONString(param),HalfBarcode.class); Page<HalfBarcode> page1 = new Page<>(curr, limit); Page<HalfBarcode> page = halfBarcodeService.getPage(halfBarcode, page1); for (HalfBarcode halfBarcode1 : page.getRecords()) { List<MatBarcode> matBarcodes = matBarcodeService .selectList(new EntityWrapper<MatBarcode>().eq("zpallet", halfBarcode1.getZpallet())); // 计算所有specs字段中*后面的数字之和 int specsSum = 0; for (MatBarcode matBarcode : matBarcodes) { String specs = matBarcode.getSpecs(); if (specs != null && specs.contains("*")) { try { String afterStar = specs.substring(specs.indexOf("*") + 1); specsSum += Integer.parseInt(afterStar.trim()); } catch (NumberFormatException e) { // 忽略无法解析的specs } } } int thickness = 0; if (Integer.parseInt(halfBarcode1.getZpallet().substring(0,1))==6){ thickness = 2650; }else if(Integer.parseInt(halfBarcode1.getZpallet().substring(0,1))==7){ thickness = 1750; }else if(Integer.parseInt(halfBarcode1.getZpallet().substring(0,1))==8){ thickness = 800; } halfBarcode1.setPrice(thickness - specsSum); } return R.ok(halfBarcodeService.selectPage(new Page<>(curr, limit), wrapper)); return R.ok(page); } private void convert(Map<String, Object> map, EntityWrapper wrapper){ for (Map.Entry<String, Object> entry : map.entrySet()){ private void convert(Map<String, Object> map, EntityWrapper wrapper) { for (Map.Entry<String, Object> entry : map.entrySet()) { String val = String.valueOf(entry.getValue()); if (val.contains(RANGE_TIME_LINK)){ if (val.contains(RANGE_TIME_LINK)) { String[] dates = val.split(RANGE_TIME_LINK); wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); } else { if (!entry.getKey().equals("price")){ if (!entry.getKey().equals("price")) { wrapper.like(entry.getKey(), val); }else { } else { wrapper.ge(entry.getKey(), val); } } src/main/java/com/zy/asrs/controller/ImagePreviewController.java
@@ -1,7 +1,6 @@ package com.zy.asrs.controller; import com.core.common.R; import com.sun.prism.Image; import com.zy.asrs.entity.ImageView; import com.zy.asrs.utils.ImagePreviewUtils; import com.zy.common.web.BaseController; src/main/java/com/zy/asrs/mapper/HalfBarcodeMapper.java
@@ -1,10 +1,14 @@ package com.zy.asrs.mapper; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.baomidou.mybatisplus.plugins.Page; import com.zy.asrs.entity.HalfBarcode; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import org.apache.ibatis.annotations.Mapper; import java.util.List; import java.util.Map; @Mapper @Repository @@ -13,4 +17,6 @@ HalfBarcode selectByZpallet(String zpallet); boolean half(HalfBarcode halfBarcode); List<HalfBarcode> getList(Page<HalfBarcode> page1, HalfBarcode halfBarcode); } src/main/java/com/zy/asrs/service/HalfBarcodeService.java
@@ -1,10 +1,15 @@ package com.zy.asrs.service; import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.IService; import com.zy.asrs.entity.HalfBarcode; import java.util.Map; public interface HalfBarcodeService extends IService<HalfBarcode> { HalfBarcode selectByZpallet(String zpallet); boolean half(HalfBarcode halfBarcode); Page<HalfBarcode> getPage(HalfBarcode halfBarcode, Page<HalfBarcode> page1); } src/main/java/com/zy/asrs/service/impl/HalfBarcodeServiceImpl.java
@@ -1,11 +1,15 @@ package com.zy.asrs.service.impl; import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.zy.asrs.entity.HalfBarcode; import com.zy.asrs.mapper.HalfBarcodeMapper; import com.zy.asrs.service.HalfBarcodeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; @Service("HalfBarcodeService") public class HalfBarcodeServiceImpl extends ServiceImpl<HalfBarcodeMapper, HalfBarcode> implements HalfBarcodeService { @@ -20,4 +24,11 @@ public boolean half(HalfBarcode halfBarcode) { return halfBarcodeMapper.half(halfBarcode); } @Override public Page<HalfBarcode> getPage(HalfBarcode halfBarcode, Page<HalfBarcode> page1) { List<HalfBarcode> list = this.halfBarcodeMapper.getList(page1, halfBarcode); page1.setRecords(list); return page1; } } src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -298,85 +298,88 @@ List<WrkDetl> wrkDetls54 = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); if (wrkDetls54.isEmpty()) { // exceptionHandle("并板入库 ===>> 工作明细档为空;[workNo={0}]", wrkMast.getWrkNo()); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return FAIL.setMsg("并板入库 ===>> 工作明细档为空; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); } // 修改库存明细数量,如无库存,曾新增 for (WrkDetl wrkDetl : wrkDetls54) { // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); log.info("并板入库 ===>> 工作明细档为空; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); // return FAIL.setMsg("并板入库 ===>> 工作明细档为空; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); }else { // 修改库存明细数量,如无库存,曾新增 for (WrkDetl wrkDetl : wrkDetls54) { LocDetl locDetl = locDetlService.selectItem(locMast.getLocNo(), wrkDetl); if (null != locDetl) { if (!locDetlService.updateAnfme(wrkDetl.getAnfme(), locMast.getLocNo(), wrkDetl)) { LocDetl locDetl = locDetlService.selectItem(locMast.getLocNo(), wrkDetl); if (null != locDetl) { if (!locDetlService.updateAnfme(wrkDetl.getAnfme(), locMast.getLocNo(), wrkDetl)) { // exceptionHandle("并板入库 ===>> 修改库存明细数量失败;[workNo={0}],[matnr={1}]", wrkMast.getWrkNo(), wrkDetl.getMatnr()); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return FAIL.setMsg("并板入库 ===>> 修改库存明细数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); } } else { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return FAIL.setMsg("并板入库 ===>> 修改库存明细数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); } } else { InOut inOut=inOutService.selectByMatnr(wrkDetl.getMatnr()); if (inOut != null){ inOut.setTemp1("在库");//属性 是否在库 inOut.setBrand(wrkDetl.getZpallet());//托盘条码 inOut.setTemp3(wrkMast.getLocNo());//库位号 InOut inOut=inOutService.selectByMatnr(wrkDetl.getMatnr()); if (inOut != null){ inOut.setTemp1("在库");//属性 是否在库 inOut.setBrand(wrkDetl.getZpallet());//托盘条码 inOut.setTemp3(wrkMast.getLocNo());//库位号 // inOut.setModiTime(now.toString()); } if (!inOutService.updateById(inOut)){ return FAIL.setMsg("更新模具属性失败"); } } if (!inOutService.updateById(inOut)){ return FAIL.setMsg("更新模具属性失败"); } //更新半托信息 HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(wrkDetl.getZpallet()); //对模具的规格做处理得到厚度 Integer thickness = 0; if (!Cools.isEmpty(wrkDetl.getSpecs())){ String[] split = wrkDetl.getSpecs().split("\\*"); thickness = Integer.parseInt(split[1]); } if (halfBarcode == null){ HalfBarcode hb = new HalfBarcode(); hb.setZpallet(wrkDetl.getZpallet()); hb.setSpecs(wrkDetl.getZpallet().substring(0,1)); hb.setAnfme(1); if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){ hb.setPrice(2650 - thickness); }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){ hb.setPrice(1750 - thickness); }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){ hb.setPrice(800 - thickness); //更新半托信息 HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(wrkDetl.getZpallet()); //对模具的规格做处理得到厚度 Integer thickness = 0; if (!Cools.isEmpty(wrkDetl.getSpecs())){ String[] split = wrkDetl.getSpecs().split("\\*"); thickness = Integer.parseInt(split[1]); } if (!halfBarcodeService.insert(hb)){ throw new CoolException("更新半托信息失败"); if (halfBarcode == null){ HalfBarcode hb = new HalfBarcode(); hb.setZpallet(wrkDetl.getZpallet()); hb.setSpecs(wrkDetl.getZpallet().substring(0,1)); hb.setAnfme(1); if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){ hb.setPrice(2650 - thickness); }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){ hb.setPrice(1750 - thickness); }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){ hb.setPrice(800 - thickness); } if (!halfBarcodeService.insert(hb)){ throw new CoolException("更新半托信息失败"); } }else { if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); halfBarcode.setPrice(halfBarcode.getPrice() - thickness); }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); halfBarcode.setPrice(halfBarcode.getPrice() - thickness); }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); halfBarcode.setPrice(halfBarcode.getPrice() - thickness); } if (!halfBarcodeService.half(halfBarcode)){ throw new CoolException("更新半托信息失败"); } } }else { if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); halfBarcode.setPrice(halfBarcode.getPrice() - thickness); }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); halfBarcode.setPrice(halfBarcode.getPrice() - thickness); }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){ halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); halfBarcode.setPrice(halfBarcode.getPrice() - thickness); } if (!halfBarcodeService.half(halfBarcode)){ throw new CoolException("更新半托信息失败"); } } locDetl = new LocDetl(); locDetl.sync(wrkDetl); locDetl.setLocNo(wrkMast.getLocNo()); // 库位号 locDetl.setAnfme(wrkDetl.getAnfme()); // 数量 locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码 locDetl.setModiTime(now); locDetl.setAppeTime(now); if (!locDetlService.insert(locDetl)) { locDetl = new LocDetl(); locDetl.sync(wrkDetl); locDetl.setLocNo(wrkMast.getLocNo()); // 库位号 locDetl.setAnfme(wrkDetl.getAnfme()); // 数量 locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码 locDetl.setModiTime(now); locDetl.setAppeTime(now); if (!locDetlService.insert(locDetl)) { // exceptionHandle("并板入库 ===>> 新增库存明细失败;[workNo={0}],[matnr={1}]", wrkMast.getWrkNo(), wrkDetl.getMatnr()); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return FAIL.setMsg("并板入库 ===>> 新增库存明细失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return FAIL.setMsg("并板入库 ===>> 新增库存明细失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); } } } } // 修改库位状态 Q ====>> F if (locMast.getLocSts().equals("Q")) { locMast.setLocSts("F"); src/main/resources/mapper/HalfBarcodeMapper.xml
@@ -10,6 +10,19 @@ <result column="specs" property="specs" /> </resultMap> <sql id="PageCondition"> <if test="zpallet != null and zpallet != '' "> and zpallet like '%' + #{zpallet} + '%' </if> <if test="specs !=null and specs!='' "> and zpallet like #{specs} + '%' </if> <if test="price!=null and price!='' "> and price like '%' + #{price} + '%' </if> </sql> <update id="half" parameterType="com.zy.asrs.entity.HalfBarcode"> UPDATE cust_half_barcode <set> @@ -22,4 +35,10 @@ </set> WHERE zpallet = #{zpallet} </update> <select id="getList" resultType="com.zy.asrs.entity.HalfBarcode"> select zpallet,sum(1) as anfme from cust_matnr_barcode where 1=1 <include refid="PageCondition"></include> group by zpallet </select> </mapper> src/main/webapp/views/halfBarcode/halfBarcode.html
@@ -29,11 +29,11 @@ <input class="layui-input" type="text" name="specs" placeholder="托盘规格" autocomplete="off"> </div> </div> <div class="layui-inline"> <div class="layui-input-inline"> <input class="layui-input" type="text" name="price" placeholder="可放厚度" autocomplete="off"> </div> </div> <!-- <div class="layui-inline">--> <!-- <div class="layui-input-inline">--> <!-- <input class="layui-input" type="text" name="price" placeholder="可放厚度" autocomplete="off">--> <!-- </div>--> <!-- </div>--> <!-- 日期范围 --> <!-- <div class="layui-inline" style="width: 300px">--> <!-- <div class="layui-input-inline">-->