|
@@ -16,10 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Description: 采购入库
|
|
@@ -134,40 +131,122 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
String rowmId="";
|
|
|
//订单子表id
|
|
|
if(map.get("cRdCode").toString().equals("11")){
|
|
|
- itemMap.put("iPOsID",itemMap.get("moDetailId"));//采购订单行id
|
|
|
- itemMap.put("iOMoDID","");//委外订单行id
|
|
|
- rowmId=String.valueOf(itemMap.get("moDetailId"));
|
|
|
+ if(itemMap.get("moDetailId")!=null&&StringUtils.isNotBlank(String.valueOf(itemMap.get("moDetailId")))) {
|
|
|
+ itemMap.put("iPOsID", itemMap.get("moDetailId"));//采购订单行id
|
|
|
+ itemMap.put("iOMoDID", "");//委外订单行id
|
|
|
+ rowmId = String.valueOf(itemMap.get("moDetailId"));
|
|
|
+ //获取订单行的数据
|
|
|
+ Map<String,Object> mapPOPodetails= this.baseMapper.getPOPodetails(rowmId);
|
|
|
+ if(mapPOPodetails!=null){
|
|
|
+ //获取订单行的自定义项数据
|
|
|
+ getcFree(itemMap,mapPOPodetails);
|
|
|
+ //回写入库数量到采购订单行
|
|
|
+ if(mapPOPodetails.get("freceivedqty")!=null){
|
|
|
+ BigDecimal freceivedqty=getDecimalNew(String.valueOf(mapPOPodetails.get("freceivedqty"))).add(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
|
|
|
+ Map<String,Object> mapFreceivedqty=new HashMap<>();
|
|
|
+ mapFreceivedqty.put("freceivedqty",freceivedqty);//入库数量
|
|
|
+ mapFreceivedqty.put("ID",rowmId);//订单行id
|
|
|
+ //回写到采购订单对应行
|
|
|
+ this.baseMapper.updatePodetailsfreceivedqty(mapFreceivedqty);
|
|
|
+ }
|
|
|
|
|
|
+ }else{
|
|
|
+ message=message+"第"+rowId+"未找到对应的采购订单行;";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ message=message+"第"+rowId+"缺少采购订单行id;";
|
|
|
+ }
|
|
|
}else{//委外入库
|
|
|
- itemMap.put("iPOsID","");//采购订单行id
|
|
|
- itemMap.put("iOMoDID",itemMap.get("moDetailId"));//委外订单行id
|
|
|
- String moDetailId=String.valueOf(itemMap.get("moDetailId"));//委外订单行id
|
|
|
- if(itemMap.get("moDetailId")!=null){
|
|
|
+
|
|
|
+ if(itemMap.get("moDetailId")!=null&&StringUtils.isNotBlank(String.valueOf(itemMap.get("moDetailId")))){
|
|
|
+ itemMap.put("iPOsID","");//采购订单行id
|
|
|
+ itemMap.put("iOMoDID",itemMap.get("moDetailId"));//委外订单行id
|
|
|
+ String moDetailId=String.valueOf(itemMap.get("moDetailId"));//委外订单行id
|
|
|
//获取来源订单号
|
|
|
Map<String,Object> omMoDetails=this.baseMapper.getOMMoDetails(moDetailId);
|
|
|
itemMap.put("iordercode",omMoDetails.get("csoordercode"));//来源订单号
|
|
|
+ rowmId=String.valueOf(itemMap.get("moDetailId"));
|
|
|
+ //获取订单行数据
|
|
|
+ Map<String,Object> mapOMMODetails=this.baseMapper.getOMMODetails(rowmId);
|
|
|
+ if(mapOMMODetails!=null){
|
|
|
+ //获取订单的自定义数据
|
|
|
+ getcFree(itemMap,mapOMMODetails);
|
|
|
+ //回写入库数量到委外订单行
|
|
|
+ if(mapOMMODetails.get("iReceivedQTY")!=null){
|
|
|
+ BigDecimal freceivedqty=getDecimalNew(String.valueOf(mapOMMODetails.get("iReceivedQTY"))).add(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
|
|
|
+ Map<String,Object> mapFreceivedqty=new HashMap<>();
|
|
|
+ mapFreceivedqty.put("iReceivedQTY",freceivedqty);//入库数量
|
|
|
+ mapFreceivedqty.put("ID",rowmId);//订单行id
|
|
|
+ //回写到委外订单对应行
|
|
|
+ this.baseMapper.updateOMMODetailsfreceivedqty(mapFreceivedqty);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ message=message+"第"+rowId+"未找到对应的委外订单行;";
|
|
|
+ }
|
|
|
}else{
|
|
|
- message=message+"缺少委外订单行id;";
|
|
|
+ message=message+"第"+rowId+"缺少委外订单行id;";
|
|
|
}
|
|
|
- rowmId=String.valueOf(itemMap.get("moDetailId"));
|
|
|
}
|
|
|
//如果是红字入库则处理是否需要做结算单
|
|
|
if(map.get("cVouchType").toString().equals("1")){
|
|
|
//保存结算单
|
|
|
// savePurSettleVouch(map,itemMap,rowmId);
|
|
|
+ itemMap.put("iQuantity","-"+itemMap.get("iQuantity"));
|
|
|
}
|
|
|
|
|
|
rowId++;
|
|
|
+ if(StringUtils.isEmpty(message)) {
|
|
|
+ this.baseMapper.saveRdrecords01(itemMap);
|
|
|
+ }
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(message)){
|
|
|
throw new RuntimeException(message);
|
|
|
}
|
|
|
- this.baseMapper.saveRdrecords01One(itemList);
|
|
|
+// this.baseMapper.saveRdrecords01One(itemList);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //获取采购订单行自定义项数据与存货自定义项数据
|
|
|
+ public void getcFree(Map<String,Object> itemMap,Map<String,Object> mapPOPodetails){
|
|
|
+ itemMap.put("cDefine22",setNull(mapPOPodetails.get("cDefine22")));
|
|
|
+ itemMap.put("cDefine23",setNull(mapPOPodetails.get("cDefine23")));
|
|
|
+ itemMap.put("cDefine24",setNull(mapPOPodetails.get("cDefine24")));
|
|
|
+ itemMap.put("cDefine25",setNull(mapPOPodetails.get("cDefine25")));
|
|
|
+ itemMap.put("cDefine26",setNull(mapPOPodetails.get("cDefine26")));
|
|
|
+ itemMap.put("cDefine27",setNull(mapPOPodetails.get("cDefine27")));
|
|
|
+ itemMap.put("cDefine28",setNull(mapPOPodetails.get("cDefine28")));
|
|
|
+ itemMap.put("cDefine29",setNull(mapPOPodetails.get("cDefine29")));
|
|
|
+ itemMap.put("cDefine30",setNull(mapPOPodetails.get("cDefine30")));
|
|
|
+ itemMap.put("cDefine31",setNull(mapPOPodetails.get("cDefine31")));
|
|
|
+ itemMap.put("cDefine32",setNull(mapPOPodetails.get("cDefine32")));
|
|
|
+ itemMap.put("cDefine33",setNull(mapPOPodetails.get("cDefine33")));
|
|
|
+ itemMap.put("cDefine34",setNull(mapPOPodetails.get("cDefine34")));
|
|
|
+ itemMap.put("cDefine35",setNull(mapPOPodetails.get("cDefine35")));
|
|
|
+ itemMap.put("cDefine36",setNull(mapPOPodetails.get("cDefine36")));
|
|
|
+ itemMap.put("cDefine37",setNull(mapPOPodetails.get("cDefine37")));
|
|
|
+ itemMap.put("cFree1",setNull(mapPOPodetails.get("cFree1")));
|
|
|
+ itemMap.put("cFree2",setNull(mapPOPodetails.get("cFree2")));
|
|
|
+ itemMap.put("cFree3",setNull(mapPOPodetails.get("cFree3")));
|
|
|
+ itemMap.put("cFree4",setNull(mapPOPodetails.get("cFree4")));
|
|
|
+ itemMap.put("cFree5",setNull(mapPOPodetails.get("cFree5")));
|
|
|
+ itemMap.put("cFree6",setNull(mapPOPodetails.get("cFree6")));
|
|
|
+ itemMap.put("cFree7",setNull(mapPOPodetails.get("cFree7")));
|
|
|
+ itemMap.put("cFree8",setNull(mapPOPodetails.get("cFree8")));
|
|
|
+ itemMap.put("cFree9",setNull(mapPOPodetails.get("cFree9")));
|
|
|
+ itemMap.put("cFree10",setNull(mapPOPodetails.get("cFree10")));
|
|
|
+ }
|
|
|
+ public Object setNull(Object o){
|
|
|
+ if(o==null){
|
|
|
+ return "";
|
|
|
+ }else{
|
|
|
+ return o;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存结算单
|
|
|
public void savePurSettleVouch(Map<String,Object> map,Map<String,Object> itemMap,String rowmId){
|
|
|
BigDecimal rdiQuantity=getDecimalNew(String.valueOf(itemMap.get("iQuantity")));
|
|
|
BigDecimal decimal=this.baseMapper.getRdrecords01WriteQuantity(rowmId);
|
|
@@ -235,7 +314,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
}
|
|
|
|
|
|
//保存调拨单
|
|
|
- public void saveTransVouch(Map<String,Object> rdRecord01Map){
|
|
|
+ public void saveTransVouch(Map<String,Object> rdRecord01Map,List<Map<String,Object>> rdRecords01List){
|
|
|
Map<String,Object> transVouchMao=new HashMap<>();
|
|
|
//获取主表最大ID
|
|
|
transVouchMao.put("ID",oConvertUtils.addOne(getMaxId("ID","TransVouch")));
|
|
@@ -279,6 +358,24 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
//业务员
|
|
|
transVouchMao.put("cPersonCode",rdRecord01Map.get("cPersonCode"));
|
|
|
this.baseMapper.saveTransVouch(transVouchMao);
|
|
|
+ List<Map<String,Object>> transVouchsList=new ArrayList<>();
|
|
|
+ if(rdRecords01List!=null&&rdRecords01List.size()>0){
|
|
|
+ for(Map<String,Object> recordsMap:rdRecords01List){
|
|
|
+ Map<String,Object> vouchsMap=new HashMap<>();
|
|
|
+ vouchsMap.put("comcode",rdRecord01Map.get("cOrderCode"));//委外订单号
|
|
|
+ vouchsMap.put("cDefine22",recordsMap.get("cDefine22"));//款号
|
|
|
+ vouchsMap.put("cTVBatch",recordsMap.get("cBatch"));//批号
|
|
|
+ vouchsMap.put("cInvCode",recordsMap.get("cInvCode"));//存货编码
|
|
|
+ vouchsMap.put("iTVQuantity",recordsMap.get("iQuantity"));//数量
|
|
|
+ vouchsMap.put("cFree1",recordsMap.get(""));//颜色
|
|
|
+ vouchsMap.put("cFree2",recordsMap.get(""));//尺码
|
|
|
+ vouchsMap.put("cFree4",recordsMap.get(""));//光坯门幅
|
|
|
+ vouchsMap.put("cFree6",recordsMap.get(""));//克重/工艺
|
|
|
+ vouchsMap.put("cFree5",recordsMap.get(""));//品质/品种
|
|
|
+ vouchsMap.put("cDefine30",recordsMap.get(""));//染厂色号
|
|
|
+ vouchsMap.put("cbMemo",recordsMap.get(""));//备注
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|