|  |  | 
 |  |  | import com.baomidou.mybatisplus.mapper.Wrapper; | 
 |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
 |  |  | import com.core.common.*; | 
 |  |  | import net.sf.jsqlparser.expression.DateTimeLiteralExpression; | 
 |  |  | import org.apache.poi.ss.formula.functions.Now; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | import zy.cloud.wms.manager.entity.Quality; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         quality.setBillNo(qcNo); | 
 |  |  |         quality.setHostId(getHostId()); | 
 |  |  |         quality.setAuditStatus((short)0); | 
 |  |  |         quality.setUpdateBy(getUserId()); | 
 |  |  |         quality.setUpdateTime(new Date()); | 
 |  |  |         quality.setCreateBy(getUserId()); | 
 |  |  |         qualityService.insert(quality); | 
 |  |  |  | 
 |  |  |         Wrapper<ReceiveDetl> wrapper = new EntityWrapper<ReceiveDetl>(); | 
 |  |  |         List<ReceiveDetl> list = receiveDetlService.selectList(wrapper.eq("order_no",quality.getUuid() )); | 
 |  |  |         int seq = 1; | 
 |  |  |         if(list.size()>0){ | 
 |  |  |             for(ReceiveDetl detl:list){ | 
 |  |  |                 QualityDetl qualityDetl = new QualityDetl(); | 
 |  |  |                 qualityDetl.setQualityId(quality.getId()); | 
 |  |  |                 qualityDetl.setAnfme(detl.getAnfme()); | 
 |  |  |                 qualityDetl.setBillNo(qcNo); | 
 |  |  |                 qualityDetl.setSeqNo(seq); | 
 |  |  | 
 |  |  |                 qualityDetl.setMatnr(detl.getMatnr()); | 
 |  |  |                 qualityDetl.setMaktx(detl.getMaktx()); | 
 |  |  |                 qualityDetl.setProdDate(new Date()); | 
 |  |  |                 qualityDetl.setHostId(getHostId()); | 
 |  |  |                 qualityDetlService.insert(qualityDetl); | 
 |  |  |                 seq++; | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  |             return R.error("入库单号不存在"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         quality.setBillNo(qcNo); | 
 |  |  |         quality.setAuditStatus((short)0); | 
 |  |  |         qualityService.insert(quality); | 
 |  |  |  | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  | 
 |  |  |         if (Cools.isEmpty(quality) || null==quality.getId()){ | 
 |  |  |             return R.error(); | 
 |  |  |         } | 
 |  |  |         quality.setUpdateTime(new Date()); | 
 |  |  |         qualityService.updateById(quality); | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 
 |  |  | 
 |  |  | import com.core.common.DateUtils; | 
 |  |  | import zy.cloud.wms.manager.entity.Quality; | 
 |  |  | import zy.cloud.wms.manager.entity.QualityDetl; | 
 |  |  | import zy.cloud.wms.manager.entity.ReceiveDetl; | 
 |  |  | import zy.cloud.wms.manager.service.QualityDetlService; | 
 |  |  | import com.core.annotations.ManagerAuth; | 
 |  |  | import com.core.common.BaseRes; | 
 |  |  | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  | import zy.cloud.wms.manager.service.QualityService; | 
 |  |  | import zy.cloud.wms.manager.service.ReceiveDetlService; | 
 |  |  |  | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | 
 |  |  |     private QualityDetlService qualityDetlService; | 
 |  |  |     @Autowired | 
 |  |  |     private QualityService qualityService; | 
 |  |  |     @Autowired | 
 |  |  |     private ReceiveDetlService receiveDetlService; | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/qualityDetl/{id}/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R get(@PathVariable("id") String id) { | 
 |  |  | 
 |  |  |             return R.error(); | 
 |  |  |         } | 
 |  |  |         if(!Cools.isEmpty(qualityDetl.getQuaStatus())){ | 
 |  |  |         Quality quality= qualityService.selectOne(new EntityWrapper<Quality>().eq("bill_no",qualityDetl.getBillNo())); | 
 |  |  |             quality.setAuditStatus(Short.valueOf("1")); | 
 |  |  |             qualityService.updateById(quality); | 
 |  |  |             Quality quality= qualityService.selectOne(new EntityWrapper<Quality>().eq("bill_no",qualityDetl.getBillNo())); | 
 |  |  | //            if(!Cools.isEmpty(quality)) { | 
 |  |  | //                quality.setAuditStatus(Short.valueOf("1")); | 
 |  |  | //                qualityService.updateById(quality); | 
 |  |  | //            } | 
 |  |  |             ReceiveDetl receiveDetl = receiveDetlService.selectOne(new EntityWrapper<ReceiveDetl>() | 
 |  |  |                     .eq("order_no",quality.getUuid()).eq("matnr",qualityDetl.getMatnr())); | 
 |  |  |             if(!Cools.isEmpty(receiveDetl)){ | 
 |  |  |                 receiveDetl.setQuaStatus(qualityDetl.getQuaStatus()); | 
 |  |  |                 receiveDetlService.update(receiveDetl,new EntityWrapper<ReceiveDetl>() | 
 |  |  |                         .eq("order_no",quality.getUuid()).eq("matnr",qualityDetl.getMatnr())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         qualityDetl.setQuaUser(getUserId()); | 
 |  |  |         qualityDetl.setQuaDate(new Date()); | 
 |  |  |         qualityDetlService.updateById(qualityDetl); | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 
 |  |  | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import com.core.common.SpringUtils; | 
 |  |  | import zy.cloud.wms.manager.service.OrderService; | 
 |  |  | import zy.cloud.wms.manager.service.QualityService; | 
 |  |  | import zy.cloud.wms.system.service.UserService; | 
 |  |  | import zy.cloud.wms.system.entity.User; | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "质检人员") | 
 |  |  |     @TableField("qua_user") | 
 |  |  |     private String quaUser; | 
 |  |  |     private Long quaUser; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 质检时间 | 
 |  |  | 
 |  |  |  | 
 |  |  |     public QualityDetl() {} | 
 |  |  |  | 
 |  |  |     public QualityDetl(Long hostId,Long qualityId,String billNo,Integer seqNo,String orderNo,Double anfme,String matnr,String maktx,String specs,String model,String batch,String unit,Date prodDate,Double rejectQty,String rejectReason,Integer quaStatus,Long updateBy,Date updateTime,Long createBy,Date createTime,String quaUser,Date quaDate) { | 
 |  |  |     public QualityDetl(Long hostId,Long qualityId,String billNo,Integer seqNo,String orderNo,Double anfme,String matnr,String maktx,String specs,String model,String batch,String unit,Date prodDate,Double rejectQty,String rejectReason,Integer quaStatus,Long updateBy,Date updateTime,Long createBy,Date createTime,Long quaUser,Date quaDate) { | 
 |  |  |         this.hostId = hostId; | 
 |  |  |         this.qualityId = qualityId; | 
 |  |  |         this.billNo = billNo; | 
 |  |  | 
 |  |  |  | 
 |  |  |     public Long getQualityId() { | 
 |  |  |         return qualityId; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getQualityId$(){ | 
 |  |  |         QualityService service = SpringUtils.getBean(QualityService.class); | 
 |  |  |         Quality quality = service.selectById(this.qualityId); | 
 |  |  |         if (!Cools.isEmpty(quality)){ | 
 |  |  |             return String.valueOf(quality.getId()); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setQualityId(Long qualityId) { | 
 |  |  | 
 |  |  |         this.createTime = createTime; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getQuaUser$(){ | 
 |  |  |         UserService service = SpringUtils.getBean(UserService.class); | 
 |  |  |         User user = service.selectById(this.quaUser); | 
 |  |  |         if (!Cools.isEmpty(user)){ | 
 |  |  |             return String.valueOf(user.getNickname()); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Date getQuaDate() { | 
 |  |  |         return quaDate; | 
 |  |  |     } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     public String getOrderId$(){ | 
 |  |  |         ReceiveService receiveService = SpringUtils.getBean(ReceiveService.class); | 
 |  |  |         Receive receive = receiveService.selectOne(new EntityWrapper<Receive>() | 
 |  |  |                 .eq("id", orderId)); | 
 |  |  |         Receive receive = receiveService.selectById(this.orderId); | 
 |  |  |         if (!Cools.isEmpty(receive)) { | 
 |  |  |             return receive.getOrderNo(); | 
 |  |  |         }else { | 
 |  |  |             return orderId + ""; | 
 |  |  |             return String.valueOf(receive.getId()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Long getId() { | 
 |  |  |         return id; | 
 |  |  |     } | 
 
 |  |  | 
 |  |  |             {type: 'checkbox'} | 
 |  |  |             //,{field: 'id', align: 'center',title: 'ID'} | 
 |  |  |             ,{field: 'billNo', align: 'center',title: '检验编号'} | 
 |  |  |             ,{field: 'uuid', align: 'center',title: '入库单号'} | 
 |  |  |             ,{field: 'auditStatus$', align: 'center',title: '审核状态'} | 
 |  |  |             ,{field: 'memo', align: 'center',title: '备注', hide:true} | 
 |  |  |             ,{align: 'center', title: '明细', toolbar: '#tbLook'} | 
 |  |  | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 1, | 
 |  |  |                     title: false, | 
 |  |  |                     area: '1000px', | 
 |  |  |                     area: '1200px', | 
 |  |  |                     offset: [offset.top + 'px', (offset.left - 530 + $a.outerWidth()) + 'px'], | 
 |  |  |                     shade: .01, | 
 |  |  |                     shadeClose: true, | 
 |  |  | 
 |  |  |                             cols: [[ | 
 |  |  |                                 // {type: 'numbers'}, | 
 |  |  |                                 // {field: 'billNo', title: '检验编号', align: 'center'}, | 
 |  |  |                                 {field: 'seqNo', title: '单据行号', align: 'center'}, | 
 |  |  |                                 {field: 'orderNo', title: '入库单号', align: 'center'}, | 
 |  |  |                                 {field: 'anfme', title: '待入库数量', align: 'center'}, | 
 |  |  |                                 {field: 'matnr', title: '产品ID', align: 'center'}, | 
 |  |  |                                 {field: 'maktx', title: '产品名称', align: 'center'}, | 
 |  |  |                                 {field: 'seqNo', title: '行号', align: 'center', width:60}, | 
 |  |  |                                 {field: 'orderNo', title: '入库单号', align: 'center', width:175}, | 
 |  |  |                                 {field: 'anfme', title: '待入数量', align: 'center', width:90}, | 
 |  |  |                                 {field: 'matnr', title: '产品编码', align: 'center', width:175}, | 
 |  |  |                                 {field: 'maktx', title: '产品名称', align: 'center', width:175}, | 
 |  |  |                                 // {field: 'maktx', title: '产品名称', align: 'center'}, | 
 |  |  |                                 {field: 'prodDate$', title: '生产日期', align: 'center'}, | 
 |  |  |                                 {field: 'quaStatus$', title: '检验状态', align: 'center'}, | 
 |  |  |                                 {field: 'rejectQty', title: '不合格数量', align: 'center'}, | 
 |  |  |                                 {field: 'quaStatus$', title: '检验状态', align: 'center', width:90}, | 
 |  |  |                                 {field: 'rejectQty', title: '不合格数量', align: 'center', width:100}, | 
 |  |  |                                 {field: 'rejectReason', title: '不合格原因', align: 'center'}, | 
 |  |  |  | 
 |  |  |                             ]], | 
 
 |  |  | 
 |  |  |         var cols = [ | 
 |  |  |             // {type: 'checkbox', fixed: 'left'}, | 
 |  |  |             {field: 'billNo', title: '检验单号', align: 'center', width: 175} | 
 |  |  |             ,{field: 'seqNo', title: '行号', align: 'center'} | 
 |  |  |             ,{field: 'orderNo', title: '入库单号', align: 'center'} | 
 |  |  |             ,{field: 'seqNo', title: '行号', align: 'center', width: 60} | 
 |  |  |             ,{field: 'orderNo', title: '入库单号', align: 'center', width: 175} | 
 |  |  |             ,{field: 'anfme', title: '数量', align: 'center'} | 
 |  |  |             ,{field: 'matnr', title: '商品编码', align: 'center'} | 
 |  |  |             ,{field: 'matnr', title: '商品编码', align: 'center', width: 175} | 
 |  |  |             ,{field: 'maktx', title: '商品名称', align: 'center'} | 
 |  |  |             ,{field: 'batch', title: '批号', align: 'center'} | 
 |  |  |             ,{field: 'prodDate$', title: '生产日期', align: 'center'} | 
 |  |  |             ,{field: 'rejectQty', title: '不合格数量', align: 'center'} | 
 |  |  |             ,{field: 'rejectReason', title: '不合格原因', align: 'center'} | 
 |  |  |             ,{field: 'quaStatus$', title: '质检状态', align: 'center'} | 
 |  |  |             ,{field: 'quaUser$', title: '质检人员', align: 'center'} | 
 |  |  |             ,{field: 'quaDate$', title: '质检时间', align: 'center'} | 
 |  |  |             ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operateCheck', width:140} | 
 |  |  |             // ,{field: 'orderNo', title: '订单号', width:115, align: 'center'} | 
 |  |  |             // ,{field: 'specs', align: 'center',title: '属性'} | 
 |  |  | 
 |  |  |                     form.on('submit(editSubmit)', function (data) { | 
 |  |  |                         if(data.field.rejectQty<0){ | 
 |  |  |                             layer.msg("不合格数量不可小于0") | 
 |  |  |                             return; | 
 |  |  |                             return false; | 
 |  |  |                         } | 
 |  |  |                         if(data.field.rejectQty>data.field.anfme){ | 
 |  |  |                         if(Number(data.field.rejectQty)>Number(data.field.anfme)){ | 
 |  |  |                             layer.msg("不合格数量不可大于入库数量"); | 
 |  |  |                             return; | 
 |  |  |                             return false; | 
 |  |  |                         } | 
 |  |  |                         var loadIndex = layer.load(2); | 
 |  |  |                         $.ajax({ |