| | |
| | | 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; |
| | | import zy.cloud.wms.manager.entity.QualityDetl; |
| | | import zy.cloud.wms.manager.entity.Receive; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import zy.cloud.wms.manager.service.ReceiveDetlService; |
| | | import zy.cloud.wms.manager.utils.AddZero; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | EntityWrapper<Quality> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } else { |
| | | wrapper.orderBy("create_time",false); |
| | | } |
| | | return R.ok(qualityService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | |
| | | @RequestMapping(value = "/quality/add/auth") |
| | | @ManagerAuth |
| | | @Transactional |
| | | public R add(Quality quality) { |
| | | String qcNo = ""; |
| | | if(!Cools.isEmpty(quality.getBillNo())) { |
| | | qcNo = quality.getBillNo(); |
| | | } else { |
| | | String sheetNo = "QUA-" + new SimpleDateFormat("yyyyMMdd").format(new Date()) + "-"; |
| | | String currNum = qualityService.getCurrNum(sheetNo); |
| | | if (!Cools.isEmpty(currNum)) { |
| | | String[] split = currNum.split("-"); |
| | | if (split.length < 3) { |
| | | qcNo = sheetNo + "0001"; |
| | | } else { |
| | | Integer newNum = Integer.parseInt(split[2]) + 1; |
| | | String format = AddZero.addZeroForNum(newNum + "", 4); |
| | | qcNo = sheetNo + format; |
| | | } |
| | | } else { |
| | | qcNo = sheetNo + "0001"; |
| | | } |
| | | } |
| | | |
| | | 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.setAnfme(detl.getAnfme()); |
| | | qualityDetl.setBillNo(quality.getBillNo()); |
| | | qualityDetl.setOrderNo(detl.getOrderNo()); |
| | | qualityDetl.setMatnr(detl.getMatnr()); |
| | | qualityDetl.setMaktx(detl.getMaktx()); |
| | | qualityDetl.setProdDate(new Date()); |
| | | qualityDetlService.insert(qualityDetl); |
| | | for(ReceiveDetl detl:list){ |
| | | QualityDetl qualityDetl = new QualityDetl(); |
| | | qualityDetl.setQualityId(quality.getId()); |
| | | qualityDetl.setAnfme(detl.getAnfme()); |
| | | qualityDetl.setBillNo(qcNo); |
| | | qualityDetl.setSeqNo(seq); |
| | | qualityDetl.setOrderNo(detl.getOrderNo()); |
| | | qualityDetl.setMatnr(detl.getMatnr()); |
| | | qualityDetl.setMaktx(detl.getMaktx()); |
| | | qualityDetl.setProdDate(new Date()); |
| | | qualityDetl.setHostId(getHostId()); |
| | | qualityDetlService.insert(qualityDetl); |
| | | seq++; |
| | | } |
| | | } else { |
| | | return R.error("入库单号不存在"); |
| | | } |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/quality/orderNo/init1") |
| | | @ManagerAuth(memo = "生成单据编号") |
| | | public R initOrderNo() { |
| | | String billNo = "QC-" + new SimpleDateFormat("yyyyMMdd").format(new Date())+"-"; |
| | | String currNum = qualityService.getCurrNum(billNo); |
| | | String orderNo=null; |
| | | if (!Cools.isEmpty(currNum)) { |
| | | String[] split = currNum.split("-"); |
| | | if (split.length < 2){ |
| | | orderNo= billNo + "0001"; |
| | | } |
| | | Integer newNum = Integer.parseInt(split[2]) +1; |
| | | String format = AddZero.addZeroForNum(newNum + "", 4); |
| | | orderNo = billNo + format; |
| | | }else { |
| | | orderNo = billNo + "0001"; |
| | | } |
| | | return R.ok().add(orderNo); |
| | | } |
| | | |
| | | @RequestMapping(value = "/quality/update/auth") |
| | |
| | | if (Cools.isEmpty(quality) || null==quality.getId()){ |
| | | return R.error(); |
| | | } |
| | | quality.setUpdateTime(new Date()); |
| | | qualityService.updateById(quality); |
| | | return R.ok(); |
| | | } |