| | |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | |
| | | EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if(!Cools.isEmpty(param.get("abnormal"))&¶m.get("abnormal").equals("1")){ |
| | | wrapper.addFilter("anfme < qty"); |
| | | }else{ |
| | | param.remove("abnormal"); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | } |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else { |
| | | wrapper.orderBy("create_time", false); |
| | | } |
| | | |
| | | wrapper.eq("status", 1); |
| | | return R.ok(orderDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | Page<OrderDetl> orderDetlPage = orderDetlService.selectPage(new Page<>(curr, limit), wrapper); |
| | | return R.ok(orderDetlPage); |
| | | } |
| | | |
| | | @RequestMapping(value = "/orderDetl/pakout/list/auth") |
| | |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.common.utils.Synchro; |
| | | import com.zy.system.entity.User; |
| | |
| | | private Double qty; |
| | | |
| | | /** |
| | | * 上报数量 |
| | | */ |
| | | @ApiModelProperty(value= "上报数量") |
| | | private Double units=0.0; |
| | | |
| | | /** |
| | | * 商品编码 |
| | | */ |
| | | @ApiModelProperty(value= "商品编码") |
| | |
| | | @ApiModelProperty(value= "sku") |
| | | private String sku; |
| | | |
| | | /** |
| | | * 单位量 |
| | | */ |
| | | @ApiModelProperty(value= "单位量") |
| | | private Double units; |
| | | |
| | | /** |
| | | * 条码 |
| | |
| | | private String suppCode; |
| | | |
| | | /** |
| | | * 是否批次 1: 是 0: 否 |
| | | * 红蓝字 |
| | | */ |
| | | @ApiModelProperty(value= "是否批次 1: 是 0: 否 ") |
| | | @ApiModelProperty(value= "红蓝字") |
| | | @TableField("be_batch") |
| | | private Integer beBatch; |
| | | |
| | |
| | | private Integer source; |
| | | |
| | | /** |
| | | * 要求检验 1: 是 0: 否 |
| | | * 上报次数 |
| | | */ |
| | | @ApiModelProperty(value= "要求检验 1: 是 0: 否 ") |
| | | @ApiModelProperty(value= "上报次数") |
| | | private Integer inspect; |
| | | |
| | | /** |
| | |
| | | return ""; |
| | | } |
| | | |
| | | public String getDanger$(){ |
| | | DocTypeService service = SpringUtils.getBean(DocTypeService.class); |
| | | OrderService orderServicer=SpringUtils.getBean(OrderService.class); |
| | | Order order = orderServicer.selectByNo(this.orderNo); |
| | | DocType docType = service.selectById(order.getDocType()); |
| | | if (!Cools.isEmpty(docType)){ |
| | | return String.valueOf(docType.getDocName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getBeBatch$(){ |
| | | if (null == this.beBatch){ return null; } |
| | | switch (this.beBatch){ |
| | |
| | | return "否"; |
| | | default: |
| | | return String.valueOf(this.inspect); |
| | | } |
| | | } |
| | | |
| | | public String getDanger$(){ |
| | | if (null == this.danger){ return null; } |
| | | switch (this.danger){ |
| | | case 1: |
| | | return "是"; |
| | | case 0: |
| | | return "否"; |
| | | default: |
| | | return String.valueOf(this.danger); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | |
| | | int increaseWorkQtytest(@Param("orderNo")String orderNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("anfme")Double anfme); |
| | | |
| | | List<OrderDetl> reportERPOrderDetl (); |
| | | } |
| | |
| | | |
| | | |
| | | boolean increaseWorkQtytest(String orderNo, String matnr, String batch, Double anfme); |
| | | |
| | | List<OrderDetl> reportERPOrderDetl(); |
| | | } |
| | |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service("orderDetlService") |
| | |
| | | public boolean increaseWorkQtytest(String orderNo, String matnr, String batch, Double anfme) { |
| | | return this.baseMapper.increaseWorkQtytest(orderNo, matnr, batch, anfme) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderDetl> reportERPOrderDetl() { |
| | | return this.baseMapper.reportERPOrderDetl(); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.OrderSyncHandler; |
| | |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | |
| | | @Scheduled(cron = "0 0 1 * * ? ") |
| | | public void clearApiLog(){ |
| | |
| | | if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | | List<Order> orders = orderService.selectComplete(); |
| | | for (Order order : orders) { |
| | | if(order.getDocType()== 81){ |
| | | continue; |
| | | } |
| | | try { |
| | | ReturnT<String> result = orderSyncHandler.start(order); |
| | | if (!result.isSuccess()) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 销售出库订单明细完成上报 |
| | | */ |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReport1(){ |
| | | String erpReport = Parameter.get().getErpReport(); |
| | | if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | | List<OrderDetl> orderDetls = orderDetlService.reportERPOrderDetl(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | Order order = orderService.selectByNo(orderDetl.getOrderNo()); |
| | | try { |
| | | ReturnT<String> result = orderSyncHandler.start1(order, orderDetl); |
| | | if (!result.isSuccess()) { |
| | | log.error("单据明细[orderNo={}],[matnr={}],[batch={}]上报erp失败", orderDetl.getOrderNo(), orderDetl.getMatnr(), orderDetl.getBatch()); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | log.error("单据明细[orderNo={}],[matnr={}],[batch={}]上报erp失败", orderDetl.getOrderNo(), orderDetl.getMatnr(), orderDetl.getBatch()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | |
| | | @Autowired |
| | | private ExdInstockTargetService exdInstockTargetService; |
| | | |
| | | |
| | | @Autowired |
| | | private ExdOutstockTargetService exdOutstockTargetService; |
| | | |
| | |
| | | return SUCCESS; |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | if (orderDetls.isEmpty()){ |
| | | if (orderDetls.isEmpty()) { |
| | | return SUCCESS; |
| | | } |
| | | // 入库完成上报 |
| | |
| | | exdOutstockTarget.setFbillno(orderDetl.getOrderNo()); |
| | | if (order.getDocType() == 42) { |
| | | exdOutstockTarget.setFtrantype(41); |
| | | } else if (order.getDocType() == 21) { |
| | | exdOutstockTarget.setFtrantype(81); |
| | | } else { |
| | | exdOutstockTarget.setFtrantype(order.getDocType().intValue()); |
| | | } |
| | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start1(Order order, OrderDetl orderDetl) { |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (null == docType) { |
| | | return SUCCESS; |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | if (orderDetls.isEmpty()) { |
| | | return SUCCESS; |
| | | } |
| | | |
| | | double count = orderDetl.getQty() - (Cools.isEmpty(orderDetl.getUnits()) ? 0.0 : orderDetl.getUnits()); |
| | | if (docType.getPakout() == 1) { |
| | | // 出库完成上报 |
| | | ExdOutstockTarget exdOutstockTarget = null; |
| | | exdOutstockTarget = new ExdOutstockTarget(); |
| | | //订单内码 |
| | | exdOutstockTarget.setFinterid(orderDetl.getDeadWarn()); |
| | | //单号 = erp订单号+物料编号+上报次数 |
| | | exdOutstockTarget.setFbillno(orderDetl.getOrderNo() + "--" + orderDetl.getMatnr() + "--" + orderDetl.getInspect()); |
| | | |
| | | //部门ID |
| | | exdOutstockTarget.setFdeptid(0); |
| | | //供应商/客户ID |
| | | exdOutstockTarget.setFsupplyid(0); |
| | | //制单用户ID |
| | | exdOutstockTarget.setFbillerid(0); |
| | | //细表ID |
| | | exdOutstockTarget.setFentryid(0); |
| | | //物料ID |
| | | exdOutstockTarget.setFitemid(0); |
| | | //源单数量 |
| | | exdOutstockTarget.setFqtymust(0.0); |
| | | //出库数量 |
| | | //单据类型 |
| | | exdOutstockTarget.setFtrantype(21); |
| | | |
| | | //单据日期 |
| | | exdOutstockTarget.setFdate(DateUtils.convert(order.getOrderTime())); |
| | | //红蓝字 |
| | | exdOutstockTarget.setFrob(orderDetl.getBeBatch()); |
| | | //操作用户 |
| | | exdOutstockTarget.setFuserid(Integer.getInteger(orderDetl.getColor())); |
| | | //写入时间 |
| | | exdOutstockTarget.setWritetime(new Date()); |
| | | //写入者 |
| | | exdOutstockTarget.setWritor("WMS"); |
| | | //状态 |
| | | exdOutstockTarget.setStatus(0); |
| | | if (exdOutstockTargetService.insert(exdOutstockTarget)) { |
| | | orderDetl.setInspect((Cools.isEmpty(orderDetl.getInspect()) ? 1 : (orderDetl.getInspect() + 1))); |
| | | orderDetl.setUnits(count + (Cools.isEmpty(orderDetl.getUnits()) ? 0.0 : orderDetl.getUnits())); |
| | | orderDetlService.updateById(orderDetl); |
| | | } |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | } |
| | |
| | | exdInstockTarge.setFtrantype(21); |
| | | exdInstockTarge.setFdate(new Date()); |
| | | exdInstockTarge.setFrob(1); |
| | | |
| | | exdInstockTarge.setFqty(wrkDetl.getAnfme()); |
| | | exdInstockTarge.setFbatchno(bacode.getBatchno()); |
| | | exdInstockTarge.setFsourcebillno(bacode.getIcmono()); |
| | | exdInstockTarge.setFsourcetrantype(85); |
| | | |
| | | exdInstockTarge.setFentryid(i); |
| | | exdInstockTarge.setFsmanagerid(Integer.valueOf(wrkDetl.getColor())); |
| | | exdInstockTarge.setFfmanagerid(Integer.valueOf(wrkDetl.getColor())); |
| | | exdInstockTarge.setFdeptid(7502); |
| | | exdInstockTarge.setFbillerid(Integer.valueOf(wrkDetl.getColor())); |
| | | exdInstockTarge.setFfmanagerid(Integer.valueOf(wrkDetl.getColor())); |
| | | exdInstockTarge.setFsmanagerid(Integer.valueOf(wrkDetl.getColor())); |
| | | exdInstockTarge.setFentryid(i); |
| | | exdInstockTarge.setFitemid(Integer.parseInt(wrkDetl.getSku())); |
| | | |
| | | exdInstockTarge.setFqty(wrkDetl.getAnfme()); |
| | | //单价 |
| | | exdInstockTarge.setFprice(0.0); |
| | | exdInstockTarge.setFbatchno(bacode.getBatchno()); |
| | | //单价ID |
| | | exdInstockTarge.setFunitid(0); |
| | | //源单号 |
| | | exdInstockTarge.setFsourcebillno(bacode.getIcmono()); |
| | | //源单细表ID |
| | | exdInstockTarge.setFsourceentryid(i); |
| | | //源单单据类型 |
| | | exdInstockTarge.setFsourcetrantype(85); |
| | | //库位ID |
| | | exdInstockTarge.setFdcspid(0); |
| | | //仓库ID |
| | | |
| | | exdInstockTarge.setFdcstockid(wrkDetl.getBrand()); |
| | | |
| | | //exdInstockTarge.setFdcspid(wrkMast.getLocNo()); |
| | | //exdInstockTarge.setFdcstockid(wrkDetl.getBrand()); |
| | | |
| | | |
| | | exdInstockTarge.setBarcode(wrkDetl.getBatch()); |
| | | exdInstockTarge.setGross(bacode.getGross()); |
| | |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setQty(0.0D); |
| | | orderDetl.setDeadWarn(detlDto.getFInterID()); |
| | | orderDetl.setInspect(detlDto.getFrob()); |
| | | orderDetl.setBeBatch(detlDto.getFrob()); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("生成单据明细失败,请联系管理员"); |
| | | } |
| | |
| | | ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) |
| | | </select> |
| | | |
| | | <select id="reportERPOrderDetl" resultMap="BaseResultMap"> |
| | | select d.* from man_order_detl d |
| | | LEFT JOIN man_order o on o.order_no = d.order_no |
| | | where 1=1 |
| | | and o.doc_type = 81 |
| | | and d.work_qty = d.qty |
| | | and d.qty = d.anfme |
| | | and d.qty > d.units |
| | | </select> |
| | | |
| | | <select id="getPakoutPageCount" parameterType="java.util.Map" resultType="java.lang.Integer"> |
| | | select |
| | | count(1) |
| | |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', align: 'center',title: 'ID'} |
| | | ,{field: 'orderNo', align: 'center',title: '订单编码',sort:true} |
| | | ,{field: 'danger$', align: 'center',title: '订单类型', hide: false} |
| | | ,{field: 'matnr', align: 'center',title: '商品编码',sort:true} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称',sort:true} |
| | | ,{field: 'anfme', align: 'center',title: '数量',sort:true} |
| | |
| | | ,{field: 'brand', align: 'center',title: '产线',sort:true, hide: true} |
| | | ,{field: 'sku', align: 'center',title: '等级',sort:true, hide: true} |
| | | ,{field: 'unit', align: 'center',title: '单位', hide: true} |
| | | ,{field: 'danger$', align: 'center',title: '订单类型', hide: true} |
| | | |
| | | |
| | | ,{field: 'anfme$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 160, width: 160}, |
| | | // ,{field: 'unitPrice', align: 'center',title: '单价'} |
| | |
| | | // ,{field: 'createBy$', align: 'center',title: '添加人员'} |
| | | {field: 'createTime$', align: 'center',title: '添加时间'} |
| | | |
| | | ,{field: 'inspect$', align: 'center',title: '上报次数', width: 100} |
| | | ,{field: 'inspect', align: 'center',title: '上报次数', width: 100} |
| | | // ,{field: 'updateBy$', align: 'center',title: '修改人员'} |
| | | // ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | // ,{field: 'memo', align: 'center',title: '备注'} |