| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.entity.result.OpenOrderCompeteResult; |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.mapper.TagMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | | import com.zy.asrs.utils.TimeCalculatorUtils; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.utils.NodeUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private TagService tagService; |
| | | @Autowired |
| | | private TagMapper tagMapper; |
| | | @Autowired |
| | | private LocMastServiceImpl locMastService; |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | now, // 添加时间 |
| | | 9527L, // 修改人员 |
| | | now, // 修改时间 |
| | | null // 备注 |
| | | null, // 备注 |
| | | 1 |
| | | ); |
| | | order.setPakinPakoutStatus(1); |
| | | if (!orderService.insert(order)) { |
| | | throw new CoolException("生成单据主档失败,请联系管理员"); |
| | | } |
| | |
| | | orderDetl.setUpdateTime(now); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setQty(0.0D); |
| | | orderDetl.setPakinPakoutStatus(1); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("生成单据明细失败,请联系管理员"); |
| | | } |
| | |
| | | now, // 添加时间 |
| | | 9527L, // 修改人员 |
| | | now, // 修改时间 |
| | | null // 备注 |
| | | null, // 备注 |
| | | 2 |
| | | ); |
| | | order.setPakinPakoutStatus(2); |
| | | if (!orderService.insert(order)) { |
| | | throw new CoolException("生成单据主档失败,请联系管理员"); |
| | | } |
| | |
| | | orderDetl.setUpdateTime(now); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setQty(0.0D); |
| | | orderDetl.setPakinPakoutStatus(2); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("生成单据明细失败,请联系管理员"); |
| | | } |
| | |
| | | } else { |
| | | tagId = tagService.getTop().getId(); |
| | | } |
| | | mat.sync(param); |
| | | mat.sync(matParam); |
| | | // mat.setMatnr(param.getMatnr()); |
| | | // mat.setMaktx(param.getMaktx()); |
| | | // mat.setSpecs(param.getSpecs()); |
| | |
| | | log.info("同步新物料[商品编号:{}]", mat.getMatnr()); |
| | | } |
| | | } else { |
| | | mat.sync(param); |
| | | mat.sync(matParam); |
| | | if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr",matParam.getMatnr()))) { |
| | | throw new CoolException("更新已存在商品信息失败,请联系管理员"); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ViewStockUseBeanDigitalTwin digitalTwinOverview() { |
| | | ViewStockUseBeanDigitalTwin viewStockUseBeanDigitalTwin = new ViewStockUseBeanDigitalTwin(); |
| | | int selectCountLocDetl = locDetlService.selectCount(new EntityWrapper<LocDetl>()); |
| | | viewStockUseBeanDigitalTwin.setRemainingStock(Integer.toUnsignedLong(selectCountLocDetl)); |
| | | int selectCountLocMast = locMastService.selectCount(new EntityWrapper<LocMast>()); |
| | | viewStockUseBeanDigitalTwin.setTotalLoc(Integer.toUnsignedLong(selectCountLocMast)); |
| | | int selectCountLocMastNEO = locMastService.selectCount(new EntityWrapper<LocMast>().ne("loc_sts","O").ne("loc_sts","X")); |
| | | viewStockUseBeanDigitalTwin.setUseLoc(Integer.toUnsignedLong(selectCountLocMastNEO)); |
| | | int selectCountLocMastO = locMastService.selectCount(new EntityWrapper<LocMast>().eq("loc_sts","O")); |
| | | viewStockUseBeanDigitalTwin.setIdleLoc(Integer.toUnsignedLong(selectCountLocMastO)); |
| | | List<ViewInOutBean> list = reportQueryMapper.getViewInOutAll(new ViewInOutBean()); |
| | | Date date = new Date(); |
| | | String format = new SimpleDateFormat(DateUtils.yyyyMMdd_F).format(date); |
| | | viewStockUseBeanDigitalTwin.setNowData(format); |
| | | for (ViewInOutBean view : list) { |
| | | if (view.getYmd().equals(format)) { |
| | | viewStockUseBeanDigitalTwin.setTodayOutbound(view.getRet_qty()); |
| | | viewStockUseBeanDigitalTwin.setTodayWarehousing(view.getSto_qty()); |
| | | break; |
| | | } |
| | | } |
| | | return viewStockUseBeanDigitalTwin; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public DigitalTwinRecentOrderParam digitalTwinRecentOrder(DigitalTwinRecentOrderParam param) { |
| | | Date date = new Date(); |
| | | if (Cools.isEmpty(param.getStartDate()) || !TimeCalculatorUtils.isValidDateFormat(param.getStartDate(), DateUtils.yyyyMMdd) || TimeCalculatorUtils.isFutureDate(param.getStartDate(), DateUtils.yyyyMMdd)) { |
| | | param.setMemo("开始日期异常 :"+param.getStartDate()); |
| | | String timeFrontSevenYesterday = new SimpleDateFormat(DateUtils.yyyyMMdd).format(TimeCalculatorUtils.timeFrontSevenYesterday6(date));//七天前 |
| | | param.setStartDate(timeFrontSevenYesterday); |
| | | String format = new SimpleDateFormat(DateUtils.yyyyMMdd).format(date);//当天 |
| | | param.setEndDate(format); |
| | | param.setMemo(param.getMemo()+";初始化日期为 :"+param.getStartDate()+"===>" + param.getEndDate()); |
| | | } else if (Cools.isEmpty(param.getEndDate()) || !TimeCalculatorUtils.isValidDateFormat(param.getEndDate(), DateUtils.yyyyMMdd)) { |
| | | param.setMemo("结束日期异常 :"+param.getEndDate()); |
| | | String format = new SimpleDateFormat(DateUtils.yyyyMMdd).format(date);//当天 |
| | | param.setEndDate(format); |
| | | param.setMemo(param.getMemo()+";初始化日期为 :"+param.getStartDate()+"===>" + param.getEndDate()); |
| | | } |
| | | List<ViewOrderParam> asrOrderView = reportQueryMapper.getAsrOrderView(param.getStartDate(), param.getEndDate()); |
| | | param.setViewOrderParamList(asrOrderView); |
| | | return param; |
| | | } |
| | | |
| | | } |