| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.ICMOMapper; |
| | | import com.zy.asrs.entity.ICMO; |
| | | import com.zy.asrs.mapper.POInStockEntryMapper; |
| | | import com.zy.asrs.mapper.POInStockMapper; |
| | | import com.zy.asrs.mapper.ReceiveRecordMapper; |
| | | import com.zy.asrs.service.ICBOMService; |
| | | import com.zy.asrs.service.ICMOService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.service.POInStockService; |
| | | import com.zy.kingdee.entity.IcmoDTO; |
| | | import com.zy.kingdee.entity.PoOrder; |
| | | import com.zy.kingdee.entity.SubContract; |
| | | import com.zy.kingdee.entity.Vendor; |
| | | import com.zy.kingdee.utils.ERPDateUtil; |
| | | import com.zy.kingdee.utils.SnowFlakeUtils; |
| | | import org.aspectj.weaver.ResolvedType; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Calendar; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.TreeSet; |
| | | import java.util.UUID; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Service("iCMOService") |
| | | @DS("slave_1") |
| | | public class ICMOServiceImpl extends ServiceImpl<ICMOMapper, ICMO> implements ICMOService { |
| | | |
| | | @Autowired |
| | | private ICBOMService icbomService; |
| | | |
| | | @Autowired |
| | | private POInStockMapper poInStockMapper; |
| | | |
| | | @Autowired |
| | | private ReceiveRecordMapper receiveRecordMapper; |
| | | |
| | | @Autowired |
| | | private POInStockEntryMapper poInStockEntryMapper; |
| | | |
| | | @Override |
| | | public List<IcmoDTO> getIcmoDTOList(IcmoDTO icmoDTO) { |
| | | return this.baseMapper.getIcmoDTOList(icmoDTO); |
| | | } |
| | | |
| | | public List<Vendor> getVendorList(Vendor vendor) { |
| | | return this.baseMapper.getVendorList(vendor); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R tongbu(List<IcmoDTO> list) { |
| | | |
| | | try { |
| | | String sameId = String.valueOf(SnowFlakeUtils.getFlowIdInstance().nextId()); |
| | | List<IcmoDTO> listReturn = new ArrayList<>(); |
| | | for (IcmoDTO detail : list) { |
| | | ICMO oldIcmo = selectById(detail.getFinterid()); |
| | | if (oldIcmo != null) { |
| | | if (!(oldIcmo.getIzSyncReceive() == null ? "" : oldIcmo.getIzSyncReceive()).equals("是")) { |
| | | getBomList(detail, listReturn); |
| | | ICMO icmo = new ICMO(); |
| | | icmo.setFInterID(detail.getFinterid()); |
| | | icmo.setIzSyncReceive("是"); |
| | | updateById(icmo); |
| | | } |
| | | } |
| | | } |
| | | List<IcmoDTO> listReturn2 = (List) listReturn.stream().filter(g -> { |
| | | return (g.getInvCode().startsWith("M") || g.getFerpclsid() == null || (g.getFerpclsid().compareTo((Integer) 1) != 0 && g.getFerpclsid().compareTo((Integer) 3) != 0)) ? false : true; |
| | | }).collect(Collectors.toList()); |
| | | List<IcmoDTO> newPoList = (List) listReturn2.stream().filter(g2 -> { |
| | | return g2.getFerpclsid() != null && g2.getFerpclsid().compareTo((Integer) 1) == 0; |
| | | }).collect(Collectors.collectingAndThen(Collectors.toCollection(() -> { |
| | | return new TreeSet<>(Comparator.comparing(o -> { |
| | | return o.getFsource(); |
| | | })); |
| | | }), (v1) -> { |
| | | return new ArrayList(v1); |
| | | })); |
| | | |
| | | |
| | | |
| | | // List<IcmoDTO> listReturn2 = listReturn.stream() |
| | | // .filter(g -> g.getInvCode() != null && !g.getInvCode().startsWith("M") |
| | | // && g.getFerpclsid() != null |
| | | // && (g.getFerpclsid().compareTo(1) == 0 || g.getFerpclsid().compareTo(3) == 0)) |
| | | // .collect(Collectors.toList()); |
| | | // |
| | | // List<IcmoDTO> newPoList = listReturn2.stream() |
| | | // .filter(g2 -> g2.getFerpclsid() != null && g2.getFerpclsid().compareTo(1) == 0) |
| | | // .collect(Collectors.collectingAndThen( |
| | | // Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(IcmoDTO::getFsource))), |
| | | // ArrayList::new)); |
| | | |
| | | |
| | | for (IcmoDTO m : newPoList) { |
| | | if (m.getFsource().intValue() != 0) { |
| | | Vendor vendor = new Vendor(); |
| | | vendor.setVenId(m.getFsource()); |
| | | List<Vendor> vendors = getVendorList(vendor); |
| | | if (vendors == null || vendors.size() <= 0 || !vendors.get(0).getVenCode().contains("-")) { |
| | | POInStock poInStock = new POInStock(); |
| | | poInStock.setSameId(sameId); |
| | | poInStock.setFInterID(Integer.valueOf(this.poInStockMapper.getMaxId() + 1)); |
| | | poInStock.setFBrNo("0"); |
| | | poInStock.setFBillNo(getNewCode1(vendors.get(0).getVenCode())); |
| | | poInStock.setFCurrencyID(1); |
| | | poInStock.setFTranType((short) 72); |
| | | poInStock.setFSupplyID(m.getFsource()); |
| | | poInStock.setFDeptID(11376); |
| | | poInStock.setFEmpID(11375); |
| | | poInStock.setFDate(ERPDateUtil.parseStrToDate(ERPDateUtil.getDateStr(new Date(), "yyyy-MM-dd"), "yyyy-MM-dd")); |
| | | poInStock.setFBillerID(16399); |
| | | poInStock.setFFManagerID(0); |
| | | poInStock.setFClosed((short) 0); |
| | | poInStock.setFInvoiceClosed((short) 0); |
| | | poInStock.setFBClosed((short) 0); |
| | | poInStock.setFExchangeRate(Double.valueOf(1.0d)); |
| | | poInStock.setFStatus((short) 0); |
| | | poInStock.setFCancellation(false); |
| | | poInStock.setFUpStockWhenSave(false); |
| | | poInStock.setFPOStyle(252); |
| | | poInStock.setFRelateBrID(0); |
| | | poInStock.setFSelTranType(0); |
| | | poInStock.setFChildren(0); |
| | | poInStock.setFTranStatus(0); |
| | | poInStock.setFAreaPS(20302); |
| | | poInStock.setFManageType(0); |
| | | poInStock.setFBizType(12510); |
| | | poInStock.setFWWType(0); |
| | | poInStock.setFPrintCount((short)0); |
| | | Date date = m.getFplancommitdate(); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | cal.add(5, -2); |
| | | int day = dayForWeek(ERPDateUtil.getDateStr(cal.getTime(), "yyyy-MM-dd")); |
| | | if (day == 7) { |
| | | cal.add(5, -2); |
| | | } |
| | | poInStock.setFHeadSelfP0338(cal.getTime()); |
| | | poInStock.setFHeadSelfP0339(m.getDepCode().substring(0, m.getDepCode().indexOf("."))); |
| | | this.poInStockMapper.insert(poInStock); |
| | | ICMO icmo2 = new ICMO(); |
| | | icmo2.setTableName("POInstock"); |
| | | icmo2.setFInterID(poInStock.getFInterID()); |
| | | this.icbomService.updateMaxNum(icmo2); |
| | | List<IcmoDTO> newPoDetailList = (List) listReturn2.stream().filter(g3 -> { |
| | | return g3.getFsource().toString().equals(m.getFsource().toString()) && g3.getFerpclsid() != null && g3.getFerpclsid().compareTo((Integer) 1) == 0; |
| | | }).collect(Collectors.toList()); |
| | | List<POInStockEntry> listDetail = new ArrayList<>(); |
| | | int row = 1; |
| | | for (IcmoDTO q : newPoDetailList) { |
| | | ReceiveRecord receviceRecord = new ReceiveRecord(); |
| | | receviceRecord.setId(String.valueOf(SnowFlakeUtils.getFlowIdInstance().nextId())); |
| | | receviceRecord.setSameId(sameId); |
| | | receviceRecord.setInvId(q.getFitemid()); |
| | | receviceRecord.setRecordId(q.getFinterid()); |
| | | receviceRecord.setQty(q.getFqty() == null ? BigDecimal.ZERO : q.getFqty()); |
| | | receviceRecord.setSoCode(q.getSoCode()); |
| | | receviceRecord.setItype(ResolvedType.PARAMETERIZED_TYPE_IDENTIFIER); |
| | | receviceRecord.setIzUpdateQty("是"); |
| | | POInStockEntry poInStockEntry = listDetail.stream().filter(p -> { |
| | | return p.getFItemID().toString().equals(q.getFitemid().toString()); |
| | | }).findAny().orElse(null); |
| | | if (poInStockEntry == null) { |
| | | POInStockEntry poInStockEntry2 = new POInStockEntry(); |
| | | poInStockEntry2.setFBrNo("0"); |
| | | poInStockEntry2.setFEntryID(Integer.valueOf(row)); |
| | | poInStockEntry2.setFInterID(poInStock.getFInterID()); |
| | | poInStockEntry2.setFItemID(q.getFitemid()); |
| | | poInStockEntry2.setFQty(q.getFqty() == null ? BigDecimal.ZERO : q.getFqty()); |
| | | poInStockEntry2.setFAuxQty(poInStockEntry2.getFQty()); |
| | | poInStockEntry2.setFUnitID(q.getFunitid()); |
| | | poInStockEntry2.setFEntrySelfP0362(q.getSoCode()); |
| | | poInStockEntry2.setFOrderBillNo(q.getSoCode()); |
| | | poInStockEntry2.setFCheckMethod(352); |
| | | poInStockEntry2.setFPlanMode(14036); |
| | | poInStockEntry2.setFCommitQty(BigDecimal.ZERO); |
| | | poInStockEntry2.setFPrice(q.getForderprice() == null ? BigDecimal.ZERO : q.getForderprice()); |
| | | poInStockEntry2.setFAmount(poInStockEntry2.getFQty().multiply(poInStockEntry2.getFPrice())); |
| | | poInStockEntry2.setFAuxPrice(poInStockEntry2.getFPrice()); |
| | | poInStockEntry2.setFInvoiceQty(BigDecimal.ZERO); |
| | | poInStockEntry2.setFBCommitQty(BigDecimal.ZERO); |
| | | poInStockEntry2.setFQCheckQty(BigDecimal.ZERO); |
| | | poInStockEntry2.setFAuxQCheckQty(BigDecimal.ZERO); |
| | | poInStockEntry2.setFQtyPass(poInStockEntry2.getFQty()); |
| | | poInStockEntry2.setFAuxQtyPass(poInStockEntry2.getFQty()); |
| | | listDetail.add(poInStockEntry2); |
| | | PoOrder poOrder = new PoOrder(); |
| | | poOrder.setFitemid(poInStockEntry2.getFItemID()); |
| | | poOrder.setFentryselfp0262(q.getSoCode()); |
| | | poOrder.setFentryselfp0263(q.getFqty() == null ? BigDecimal.ZERO : q.getFqty()); |
| | | int n = this.poInStockMapper.updatePoQty(poOrder); |
| | | if (n <= 0) { |
| | | receviceRecord.setIzUpdateQty("否"); |
| | | } |
| | | row++; |
| | | } else { |
| | | poInStockEntry.setFQty(poInStockEntry.getFQty().add(q.getFqty() == null ? BigDecimal.ZERO : q.getFqty())); |
| | | poInStockEntry.setFAuxQty(poInStockEntry.getFQty()); |
| | | List<String> listSo = Arrays.asList(poInStockEntry.getFEntrySelfP0362().split(",")); |
| | | String soCode = listSo.stream().filter(p2 -> { |
| | | return p2.equals(q.getSoCode()); |
| | | }).findAny().orElse(null); |
| | | if (Cools.isEmpty(soCode)) { |
| | | poInStockEntry.setFEntrySelfP0362(poInStockEntry.getFEntrySelfP0362() + "," + q.getSoCode()); |
| | | } |
| | | PoOrder poOrder2 = new PoOrder(); |
| | | poOrder2.setFitemid(poInStockEntry.getFItemID()); |
| | | poOrder2.setFentryselfp0262(q.getSoCode()); |
| | | poOrder2.setFentryselfp0263(q.getFqty() == null ? BigDecimal.ZERO : q.getFqty()); |
| | | int n2 = this.poInStockMapper.updatePoQty(poOrder2); |
| | | if (n2 <= 0) { |
| | | receviceRecord.setIzUpdateQty("否"); |
| | | } |
| | | } |
| | | this.receiveRecordMapper.insert(receviceRecord); |
| | | } |
| | | Iterator<POInStockEntry> it = listDetail.iterator(); |
| | | while (it.hasNext()) { |
| | | this.poInStockEntryMapper.insert(it.next()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<IcmoDTO> newWwList = listReturn2.stream() |
| | | .filter(g4 -> g4.getFerpclsid() != null && g4.getFerpclsid().equals(3)) |
| | | .collect(Collectors.collectingAndThen( |
| | | Collectors.toMap( |
| | | IcmoDTO::getFsource, |
| | | Function.identity(), |
| | | (existing, replacement) -> existing |
| | | ), |
| | | map -> new ArrayList<>(map.values()) |
| | | )); |
| | | for (IcmoDTO m2 : newWwList) { |
| | | if (m2.getFsource().intValue() != 0) { |
| | | Vendor vendor2 = new Vendor(); |
| | | vendor2.setVenId(m2.getFsource()); |
| | | List<Vendor> vendors2 = this.baseMapper.getVendorList(vendor2); |
| | | if (vendors2 == null || vendors2.size() <= 0 || !vendors2.get(0).getVenCode().contains("-")) { |
| | | POInStock poInStock2 = new POInStock(); |
| | | poInStock2.setSameId(sameId); |
| | | poInStock2.setFInterID(Integer.valueOf(this.poInStockMapper.getMaxId() + 1)); |
| | | poInStock2.setFBrNo("0"); |
| | | poInStock2.setFBillNo(getNewCode1(vendors2.get(0).getVenCode())); |
| | | poInStock2.setFCurrencyID(1); |
| | | poInStock2.setFTranType((short) 72); |
| | | poInStock2.setFSupplyID(m2.getFsource()); |
| | | poInStock2.setFDeptID(11376); |
| | | poInStock2.setFEmpID(11375); |
| | | poInStock2.setFDate(ERPDateUtil.parseStrToDate(ERPDateUtil.getDateStr(new Date(), "yyyy-MM-dd"), "yyyy-MM-dd")); |
| | | poInStock2.setFBillerID(16399); |
| | | poInStock2.setFFManagerID(0); |
| | | poInStock2.setFClosed((short) 0); |
| | | poInStock2.setFInvoiceClosed((short) 0); |
| | | poInStock2.setFBClosed((short) 0); |
| | | poInStock2.setFExchangeRate(Double.valueOf(1.0d)); |
| | | poInStock2.setFStatus((short) 0); |
| | | poInStock2.setFCancellation(false); |
| | | poInStock2.setFUpStockWhenSave(false); |
| | | poInStock2.setFPOStyle(252); |
| | | poInStock2.setFRelateBrID(0); |
| | | poInStock2.setFSelTranType(1007105); |
| | | poInStock2.setFChildren(0); |
| | | poInStock2.setFTranStatus(0); |
| | | poInStock2.setFAreaPS(20302); |
| | | poInStock2.setFManageType(0); |
| | | poInStock2.setFBizType(12511); |
| | | poInStock2.setFWWType(14190); |
| | | poInStock2.setFPrintCount((short) 0); |
| | | Date date2 = m2.getFplancommitdate(); |
| | | Calendar cal2 = Calendar.getInstance(); |
| | | cal2.setTime(date2); |
| | | cal2.add(5, -2); |
| | | int day2 = dayForWeek(ERPDateUtil.getDateStr(cal2.getTime(), "yyyy-MM-dd")); |
| | | if (day2 == 7) { |
| | | cal2.add(5, -2); |
| | | } |
| | | poInStock2.setFHeadSelfP0338(cal2.getTime()); |
| | | poInStock2.setFHeadSelfP0339(m2.getDepCode().substring(0, m2.getDepCode().indexOf("."))); |
| | | this.poInStockMapper.insert(poInStock2); |
| | | ICMO icmo3 = new ICMO(); |
| | | icmo3.setTableName("POInstock"); |
| | | icmo3.setFInterID(poInStock2.getFInterID()); |
| | | this.baseMapper.updateMaxNum(icmo3); |
| | | List<IcmoDTO> newPoDetailList2 = (List) listReturn2.stream().filter(g5 -> { |
| | | return g5.getFsource().toString().equals(m2.getFsource().toString()) && g5.getFerpclsid() != null && g5.getFerpclsid().compareTo((Integer) 3) == 0; |
| | | }).collect(Collectors.toList()); |
| | | List<POInStockEntry> listDetail2 = new ArrayList<>(); |
| | | int row2 = 1; |
| | | for (IcmoDTO q2 : newPoDetailList2) { |
| | | ReceiveRecord receviceRecord2 = new ReceiveRecord(); |
| | | receviceRecord2.setId(String.valueOf(SnowFlakeUtils.getFlowIdInstance().nextId())); |
| | | receviceRecord2.setSameId(sameId); |
| | | receviceRecord2.setInvId(q2.getFitemid()); |
| | | receviceRecord2.setQty(q2.getFqty() == null ? BigDecimal.ZERO : q2.getFqty()); |
| | | receviceRecord2.setSoCode(q2.getSoCode()); |
| | | receviceRecord2.setRecordId(q2.getFinterid()); |
| | | receviceRecord2.setItype("W"); |
| | | receviceRecord2.setIzUpdateQty("是"); |
| | | POInStockEntry poInStockEntry3 = listDetail2.stream().filter(p3 -> { |
| | | return p3.getFItemID().toString().equals(q2.getFitemid().toString()); |
| | | }).findAny().orElse(null); |
| | | if (poInStockEntry3 == null) { |
| | | POInStockEntry poInStockEntry4 = new POInStockEntry(); |
| | | poInStockEntry4.setFBrNo("0"); |
| | | poInStockEntry4.setFEntryID(Integer.valueOf(row2)); |
| | | poInStockEntry4.setFInterID(poInStock2.getFInterID()); |
| | | poInStockEntry4.setFItemID(q2.getFitemid()); |
| | | poInStockEntry4.setFQty(q2.getFqty() == null ? BigDecimal.ZERO : q2.getFqty()); |
| | | poInStockEntry4.setFAuxQty(poInStockEntry4.getFQty()); |
| | | poInStockEntry4.setFUnitID(q2.getFunitid()); |
| | | poInStockEntry4.setFEntrySelfP0362(q2.getSoCode()); |
| | | poInStockEntry4.setFOrderBillNo(q2.getSoCode()); |
| | | poInStockEntry4.setFCheckMethod(352); |
| | | poInStockEntry4.setFPlanMode(14036); |
| | | poInStockEntry4.setFCommitQty(BigDecimal.ZERO); |
| | | poInStockEntry4.setFPrice(q2.getForderprice() == null ? BigDecimal.ZERO : q2.getForderprice()); |
| | | poInStockEntry4.setFAmount(poInStockEntry4.getFQty().multiply(poInStockEntry4.getFPrice())); |
| | | poInStockEntry4.setFAuxPrice(poInStockEntry4.getFPrice()); |
| | | poInStockEntry4.setFInvoiceQty(BigDecimal.ZERO); |
| | | poInStockEntry4.setFBCommitQty(BigDecimal.ZERO); |
| | | poInStockEntry4.setFQCheckQty(BigDecimal.ZERO); |
| | | poInStockEntry4.setFAuxQCheckQty(BigDecimal.ZERO); |
| | | poInStockEntry4.setFQtyPass(poInStockEntry4.getFQty()); |
| | | poInStockEntry4.setFAuxQtyPass(poInStockEntry4.getFQty()); |
| | | listDetail2.add(poInStockEntry4); |
| | | SubContract poOrder3 = new SubContract(); |
| | | poOrder3.setFitemid(poInStockEntry4.getFItemID()); |
| | | poOrder3.setForderno(q2.getSoCode()); |
| | | poOrder3.setFdecimal(q2.getFqty() == null ? BigDecimal.ZERO : q2.getFqty()); |
| | | int n3 = this.poInStockMapper.updateWwQty(poOrder3); |
| | | if (n3 <= 0) { |
| | | receviceRecord2.setIzUpdateQty("否"); |
| | | } |
| | | row2++; |
| | | } else { |
| | | poInStockEntry3.setFQty(poInStockEntry3.getFQty().add(q2.getFqty() == null ? BigDecimal.ZERO : q2.getFqty())); |
| | | poInStockEntry3.setFAuxQty(poInStockEntry3.getFQty()); |
| | | List<String> listSo2 = Arrays.asList(poInStockEntry3.getFEntrySelfP0362().split(",")); |
| | | String soCode2 = listSo2.stream().filter(p4 -> { |
| | | return p4.equals(q2.getSoCode()); |
| | | }).findAny().orElse(null); |
| | | if (Cools.isEmpty(soCode2)) { |
| | | poInStockEntry3.setFEntrySelfP0362(poInStockEntry3.getFEntrySelfP0362() + "," + q2.getSoCode()); |
| | | } |
| | | SubContract poOrder4 = new SubContract(); |
| | | poOrder4.setFitemid(poInStockEntry3.getFItemID()); |
| | | poOrder4.setForderno(q2.getSoCode()); |
| | | poOrder4.setFdecimal(q2.getFqty() == null ? BigDecimal.ZERO : q2.getFqty()); |
| | | int n4 = this.poInStockMapper.updateWwQty(poOrder4); |
| | | if (n4 <= 0) { |
| | | receviceRecord2.setIzUpdateQty("否"); |
| | | } |
| | | } |
| | | this.receiveRecordMapper.insert(receviceRecord2); |
| | | } |
| | | Iterator<POInStockEntry> it2 = listDetail2.iterator(); |
| | | while (it2.hasNext()) { |
| | | this.poInStockEntryMapper.insert(it2.next()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | public List<IcmoDTO> getBomList(IcmoDTO m, List<IcmoDTO> listReturn) throws Exception { |
| | | ICBOM query = new ICBOM(); |
| | | query.setFItemID(m.getFitemid()); |
| | | List<ICBOM> parentList = this.icbomService.getList(query); |
| | | for (ICBOM parent : parentList) { |
| | | parent.setFInterID(m.getFinterid()); |
| | | parent.setFQty(m.getFqty().multiply(parent.getFQty())); |
| | | parent.setSoCode(m.getSoCode()); |
| | | parent.setDepCode(m.getDepCode()); |
| | | parent.setFplancommitdate(m.getFplancommitdate()); |
| | | listReturn = getChildList(parent, listReturn, parent.getFQty()); |
| | | } |
| | | return listReturn; |
| | | } |
| | | |
| | | public List<IcmoDTO> getChildList(ICBOM parent, List<IcmoDTO> listReturn, BigDecimal qty) { |
| | | BomChild bomChild = new BomChild(); |
| | | bomChild.setFitemid(parent.getFItemID()); |
| | | List<BomChild> childList = this.icbomService.getListByChild(bomChild); |
| | | for (BomChild child : childList) { |
| | | IcmoDTO icmoDTO = new IcmoDTO(); |
| | | icmoDTO.setFinterid(parent.getFInterID()); |
| | | icmoDTO.setSoCode(parent.getSoCode()); |
| | | icmoDTO.setFplancommitdate(parent.getFplancommitdate()); |
| | | icmoDTO.setDepCode(parent.getDepCode()); |
| | | icmoDTO.setFitemid(child.getFitemid()); |
| | | icmoDTO.setFqty(child.getFqty().multiply(qty)); |
| | | icmoDTO.setFsource(child.getFsource()); |
| | | icmoDTO.setFerpclsid(child.getFerpclsid()); |
| | | icmoDTO.setFunitid(child.getFunitid()); |
| | | icmoDTO.setInvCode(child.getInvCode()); |
| | | icmoDTO.setForderprice(child.getForderprice()); |
| | | if (child.getFplanner() == null || child.getFplanner().intValue() == 0) { |
| | | listReturn.add(icmoDTO); |
| | | } |
| | | parent.setFItemID(child.getFitemid()); |
| | | listReturn = getChildList(parent, listReturn, qty.multiply(child.getFqty())); |
| | | } |
| | | return listReturn; |
| | | } |
| | | |
| | | public String getNewCode1(String venCode) { |
| | | String strCode = venCode + ERPDateUtil.getDateStr(new Date(), DatePattern.PURE_DATE_PATTERN); |
| | | try { |
| | | String nowCode = this.poInStockMapper.getMaxCode(strCode); |
| | | if (!Cools.isEmpty(nowCode)) { |
| | | String strLeft = nowCode.substring(0, strCode.length()); |
| | | String strRight = nowCode.substring(strCode.length(), nowCode.length()); |
| | | Integer num = Integer.valueOf(Integer.valueOf(strRight).intValue() + 1); |
| | | String retu = ""; |
| | | for (int i = 0; i < 2 - String.valueOf(num).length(); i++) { |
| | | retu = retu + "0"; |
| | | } |
| | | return strLeft + retu + String.valueOf(num); |
| | | } |
| | | return strCode + "01"; |
| | | } catch (Exception e) { |
| | | return strCode + "01"; |
| | | } |
| | | } |
| | | |
| | | public static int dayForWeek(String pTime) throws Exception { |
| | | int dayForWeek; |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(format.parse(pTime)); |
| | | if (c.get(7) == 1) { |
| | | dayForWeek = 7; |
| | | } else { |
| | | dayForWeek = c.get(7) - 1; |
| | | } |
| | | return dayForWeek; |
| | | } |
| | | |
| | | |
| | | |
| | | } |