| 
					
				 | 
			
			
				@@ -157,6 +157,12 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         //订单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         itemMap.put("cPOID",String.valueOf(map.get("cOrderCode"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         String rowmId=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //判断是否批次管理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Boolean ispc=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Map<String,Object> mapInvCode= this.baseMapper.getInventoryBycInvCode(String.valueOf(itemMap.get("cInvCode"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(mapInvCode!=null&&String.valueOf(mapInvCode.get("bInvBatch")).equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ispc=true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         //订单子表id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if(map.get("cRdCode").toString().equals("11")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             if(itemMap.get("moDetailId")!=null&&StringUtils.isNotBlank(String.valueOf(itemMap.get("moDetailId")))) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -180,16 +186,19 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         this.baseMapper.updatePodetailsfreceivedqty(mapFreceivedqty); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         //回写到现存量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         itemMap.put("cWhCode",map.get("cWhCode"));//获取仓库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        Integer isCount= this.baseMapper.getCurrentStockCount(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        if(isCount!=null&&isCount>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            //修改现存量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            this.baseMapper.updateCurrentStock(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //回写到现存量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        saveCurrentStock(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        Integer isCount= this.baseMapper.getCurrentStockCount(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        if(isCount!=null&&isCount>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //判断存货是否勾选批次管理 勾选则需要新增表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if(ispc){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //新增AA_BatchProperty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        message=message+saveAA_BatchProperty(map,itemMap,mapPOPodetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    //新增AA_BatchProperty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    message=message+saveAA_BatchProperty(map,itemMap,mapPOPodetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     message=message+"第"+rowId+"未找到对应的采购订单行;"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -221,14 +230,18 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         this.baseMapper.updateOMMODetailsfreceivedqty(mapFreceivedqty); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         //回写到现存量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         itemMap.put("cWhCode",map.get("cWhCode"));//获取仓库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        Integer isCount= this.baseMapper.getCurrentStockCount(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        if(isCount!=null&&isCount>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            //修改现存量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            this.baseMapper.updateCurrentStock(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        saveCurrentStock(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        Integer isCount= this.baseMapper.getCurrentStockCount(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        if(isCount!=null&&isCount>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            //修改现存量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            this.baseMapper.updateCurrentStock(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //判断存货是否勾选批次管理 勾选则需要新增表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if(ispc) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //新增AA_BatchProperty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        message = message + saveAA_BatchProperty(map, itemMap, mapOMMODetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    //新增AA_BatchProperty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    message=message+saveAA_BatchProperty(map,itemMap,mapOMMODetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     message=message+"第"+rowId+"未找到对应的委外订单行;"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -274,6 +287,34 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //回写现存量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void saveCurrentStock(Map<String,Object> itemMap){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改现存量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //查询SCM_ITEM是否存在 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String,Object> SCM_ITEMMap=this.baseMapper.getSCM_ITEM(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String itemId=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(SCM_ITEMMap!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //存在则进行获取id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itemId=String.valueOf(SCM_ITEMMap.get("Id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else{//没找到则进行新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itemId=oConvertUtils.addOne(getMaxId("Id","SCM_ITEM")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            itemMap.put("SCMITEMId",itemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.baseMapper.saveSCM_ITEM(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //查询现存量是否存在 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            Map<String,Object> CurrentStockMap=this.baseMapper.getCurrentStock(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer isCount= this.baseMapper.getCurrentStockCount(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(isCount!=null&&isCount>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //存在则修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.baseMapper.updateCurrentStock(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //不存在则新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itemMap.put("ItemId",itemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itemMap.put("currentStockAutoID",oConvertUtils.addOne(getMaxId("AutoID","CurrentStock"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.baseMapper.insertCurrentStock(itemMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //新增AA_BatchProperty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public String saveAA_BatchProperty(Map<String,Object> map,Map<String,Object> itemMap,Map<String,Object> mapOMMODetails){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String message=""; 
			 |