| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.GlobleParameter; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.PlaExcelListener; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.entity.PlaExcel; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.Synchronized; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class PlaController extends BaseController { |
| | |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private PlaLogService plaLogService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @RequestMapping(value = "/pla/list/auth") |
| | | @ManagerAuth |
| | |
| | | excludeTrash(param); |
| | | EntityWrapper<Pla> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("pakin_time",false); |
| | | wrapper.orderBy("modify_time",false); |
| | | allLike(Pla.class, param.keySet(), wrapper, condition); |
| | | return R.ok(plaService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | |
| | | System.out.println(plas.toString()); |
| | | plas.forEach(pla -> { |
| | | Pla plaSave = plaService.selectById(pla.getId()); |
| | | pla.setModifyTime(new Date()); |
| | | plaService.updateById(pla); |
| | | |
| | | PlaLog plaLog = new PlaLog(); |
| | | BeanUtils.copyProperties(plaSave,plaLog); |
| | | plaLog.setId(null); |
| | | plaLog.setCreateTime(new Date()); |
| | | plaLogService.insert(plaLog); |
| | | plaService.updateById(pla); |
| | | |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestBody List<Pla> plas) { |
| | | System.out.println(plas.toString()); |
| | | plas.forEach(pla -> { |
| | | if(!pla.getStatus().equals(GlobleParameter.PLA_STATUS_00) || pla.getStatus().equals(GlobleParameter.PLA_STATUS_0)){ |
| | | throw new CoolException("非待入库的数据无法被删除"); |
| | | } |
| | | Pla plaSave = plaService.selectById(pla.getId()); |
| | | pla.setModifyTime(new Date()); |
| | | plaService.deleteById(pla.getId()); |
| | | |
| | | PlaLog plaLog = new PlaLog(); |
| | | BeanUtils.copyProperties(plaSave,plaLog); |
| | | plaLog.setId(null); |
| | | plaLog.setCreateTime(new Date()); |
| | | plaLogService.insert(plaLog); |
| | | |
| | | }); |
| | | return R.ok(); |
| | | } |
| | |
| | | |
| | | for (Pla pla : plas){ |
| | | |
| | | if(pla.getStockFreeze() == 0){ |
| | | throw new CoolException("库存已被冻结,请重新选择库存"); |
| | | } |
| | | |
| | | allOrderWeight += pla.getOrderWeight(); |
| | | |
| | | if(pla.getWeightAnfme() - pla.getQtyAnfme() - pla.getOrderWeight() < 0){ |
| | |
| | | } |
| | | pla.setQtyAnfme(pla.getQtyAnfme() + pla.getOrderWeight()); |
| | | pla.setHandlerBy(getUser().getUsername()); |
| | | pla.setStatus("待出库"); |
| | | pla.setStatus(GlobleParameter.PLA_STATUS_2); |
| | | pla.setModifyTime(new Date()); |
| | | pla.setPakoutTime(pla.getPakoutTime().split("\\(")[0]); |
| | | //生成此次作业信息 |
| | | PlaQty plaQty = new PlaQty(); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/viladate/auth") |
| | | @ManagerAuth |
| | | public R viladate(@RequestBody List<Pla> plas) { |
| | | plaService.viladate(plas,getUser()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/rework/auth") |
| | | @ManagerAuth |
| | | public R rework(@RequestBody List<Pla> plas) { |
| | |
| | | }); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/updateStockFreeze") |
| | | @Transactional |
| | | @ManagerAuth(memo = "库位冻结") |
| | | public R updateStockFreeze(@RequestBody List<Pla> plas){ |
| | | if (Cools.isEmpty(plas)){ |
| | | return R.error("无数据"); |
| | | } |
| | | for (Pla pla : plas){ |
| | | if (pla.getStockFreeze() == 0){ |
| | | throw new CoolException("库存已被冻结!"); |
| | | } |
| | | pla.setStockFreeze(0); |
| | | pla.setStockFreezeBy(getUser().getUsername()); |
| | | pla.setStockFreezeDate(new Date()); |
| | | pla.setModifyTime(new Date()); |
| | | plaService.updateById(pla); |
| | | } |
| | | return R.ok("冻结成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/updateStockDisFreeze") |
| | | @ManagerAuth(memo = "库位解冻") |
| | | public R updateStockDisFreeze(@RequestBody List<Pla> plas){ |
| | | if (Cools.isEmpty(plas)){ |
| | | return R.error("无数据"); |
| | | } |
| | | for (Pla pla : plas){ |
| | | if (pla.getStockFreeze() == 1){ |
| | | throw new CoolException("库位未冻结,无需解冻"); |
| | | } |
| | | if(!Cools.eq(pla.getStockFreezeBy(),getUser().getUsername())){ |
| | | throw new CoolException("无法解冻其他用户冻结的库位"); |
| | | } |
| | | pla.setStockFreeze(1); |
| | | pla.setStockFreezeBy(getUser().getUsername()); |
| | | pla.setStockFreezeDate(new Date()); |
| | | pla.setModifyTime(new Date()); |
| | | plaService.updateById(pla); |
| | | |
| | | } |
| | | return R.ok("解除冻结成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/matMaktxQuery/auth") |
| | | @ManagerAuth |
| | | public R queryMat(String condition) { |
| | | EntityWrapper<Mat> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("maktx", condition); |
| | | Page<Mat> page = matService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Mat mat : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", mat.getMaktx()); |
| | | map.put("value", mat.getMaktx()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.ok("成功同步"+listener.getTotal()+"条pla物料数据"); |
| | | } |
| | | |
| | | // 打印 |
| | | @RequestMapping(value = "/pla/print/auth") |
| | | @ManagerAuth(memo = "pla编码打印") |
| | | public R matCodePrint(@RequestBody List<Pla> plas) { |
| | | if(Cools.isEmpty(plas)) { |
| | | return R.parse(CodeRes.EMPTY); |
| | | } |
| | | List<Pla> res = new ArrayList<>(); |
| | | for (Pla pla : plas){ |
| | | res.add(pla); |
| | | } |
| | | return R.ok().add(res); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |