|
@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.jeecg.common.system.vo.DictModel;
|
|
|
import org.jeecg.config.InterfaceConnUtils;
|
|
|
import org.jeecg.modules.openApi.entity.PurchaseWarehousing;
|
|
|
import org.jeecg.modules.openApi.mapper.PurchaseWarehousingMapper;
|
|
|
import org.jeecg.modules.openApi.mapper.SubcontractingOrderMapper;
|
|
|
import org.jeecg.modules.openApi.service.IPurchaseWarehousingService;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
+import org.jeecg.modules.system.service.ISysDictService;
|
|
|
import org.jeecg.modules.system.service.ISysUserService;
|
|
|
import org.jeecg.modules.system.util.oConvertUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -41,22 +43,25 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
@Autowired
|
|
|
private SubcontractingOrderMapper subcontractingOrderMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysDictService sysDictService;
|
|
|
+
|
|
|
@DS("multi-one")
|
|
|
@Override
|
|
|
- public void savaOne(List<Map<String, Object>> mapList) {
|
|
|
- save(mapList,"901");
|
|
|
+ public void savaOne(List<Map<String, Object>> mapList,String caccId) {
|
|
|
+ save(mapList,caccId);
|
|
|
}
|
|
|
|
|
|
@DS("multi-two")
|
|
|
@Override
|
|
|
- public void savaTwo(List<Map<String, Object>> mapList) {
|
|
|
- save(mapList,"902");
|
|
|
+ public void savaTwo(List<Map<String, Object>> mapList,String caccId) {
|
|
|
+ save(mapList,caccId);
|
|
|
}
|
|
|
|
|
|
@DS("multi-three")
|
|
|
@Override
|
|
|
- public void savaThree(List<Map<String, Object>> mapList) {
|
|
|
- save(mapList,"903");
|
|
|
+ public void savaThree(List<Map<String, Object>> mapList,String caccId) {
|
|
|
+ save(mapList,caccId);
|
|
|
}
|
|
|
|
|
|
//获取最大表id
|
|
@@ -372,7 +377,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
// this.baseMapper.saveRdRecord01One(map); //主表新增
|
|
|
|
|
|
//由于前期是自己插入U8数据库 后前改变方式先择调用第三方插入接口 所以需要把字段名整体转换成第三方的
|
|
|
- JSONArray resturn =InterfaceConnUtils.doPost(saveRdRecord01JSON(map,itemList,accID),"http://192.168.1.103:8087/api/U8Server/purchaseinlist_batch_get");
|
|
|
+ JSONArray resturn =InterfaceConnUtils.doPost(saveRdRecord01JSON(map,itemList,accID),"purchaseinlist_batch_get");
|
|
|
if(resturn.getJSONObject(0).get("Result").equals("T")){
|
|
|
//成功
|
|
|
//调拨单
|
|
@@ -458,9 +463,15 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
saveItemJson.put("CFREE8",m.get("cFree8"));
|
|
|
saveItemJson.put("CFREE9",m.get("cFree9"));
|
|
|
saveItemJson.put("CFREE10",m.get("cFree10"));
|
|
|
- saveItemJson.put("CBATCHPROPERTY2",m.get("cBatchProperty2"));
|
|
|
- saveItemJson.put("CBATCHPROPERTY8",m.get("cBatchProperty8"));
|
|
|
- saveItemJson.put("CBATCHPROPERTY9",m.get("cBatchProperty9"));
|
|
|
+ if(m.get("cBatchProperty1")!=null){
|
|
|
+ saveItemJson.put("CBATCHPROPERTY1",m.get("cBatchProperty1"));
|
|
|
+ }
|
|
|
+ if(m.get("cBatchProperty2")!=null){
|
|
|
+ saveItemJson.put("CBATCHPROPERTY2",m.get("cBatchProperty2"));
|
|
|
+ }
|
|
|
+ if(m.get("cBatchProperty3")!=null){
|
|
|
+ saveItemJson.put("CBATCHPROPERTY9",m.get("cBatchProperty9"));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//回写现存量
|
|
@@ -517,24 +528,32 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
BigDecimal iTaxPrice=getDecimalNew(String.valueOf(mapOMMODetails.get("iTaxPrice")));//原币含税单价
|
|
|
BigDecimal iExchRate=getDecimalNew(String.valueOf(map.get("iExchRate")));//汇率
|
|
|
BigDecimal unitPriceIncludingTax=iTaxPrice.multiply(iExchRate);//含税单价
|
|
|
- itemMap.put("cBatchProperty2",unitPriceIncludingTax.doubleValue());//含税单价
|
|
|
- itemMap.put("cBatchProperty8",map.get("cOrderCode"));//订单号
|
|
|
- itemMap.put("cBatchProperty9",map.get("cVenAbbName"));//供应商
|
|
|
- List<Map<String,Object>> listmap=this.baseMapper.getAA_BatchPropertyCount(itemMap);
|
|
|
- //判断是否查询到数据
|
|
|
- if(listmap!=null&&listmap.size()>0){
|
|
|
- //修改
|
|
|
- if(listmap.size()==1){
|
|
|
- itemMap.put("cBatchPropertyGUID",listmap.get(0).get("cBatchPropertyGUID"));//ID
|
|
|
- this.baseMapper.updateAA_BatchPropertyByID(itemMap);
|
|
|
- }else{
|
|
|
- message=message+"存货:"+itemMap.get("cInvCode").toString()+"在AA_BatchProperty找到了多条记录";
|
|
|
- }
|
|
|
+// itemMap.put("cBatchProperty2",unitPriceIncludingTax.doubleValue());//含税单价
|
|
|
+// itemMap.put("cBatchProperty8",map.get("cOrderCode"));//订单号
|
|
|
+// itemMap.put("cBatchProperty9",map.get("cVenAbbName"));//供应商
|
|
|
+ itemMap.put("cBatchProperty1",unitPriceIncludingTax.doubleValue());//含税单价
|
|
|
+ if(itemMap.get("cFree4")!=null&&String.valueOf(itemMap.get("cFree4")).equals("/")){
|
|
|
+ itemMap.put("cBatchProperty2",itemMap.get("cDefine23"));//门幅
|
|
|
}else{
|
|
|
- //新增
|
|
|
- itemMap.put("cBatchPropertyGUID",UUID.randomUUID().toString());//ID
|
|
|
- this.baseMapper.saveAA_BatchProperty(itemMap);
|
|
|
+ itemMap.put("cBatchProperty2",itemMap.get("cFree4"));//门幅
|
|
|
}
|
|
|
+
|
|
|
+ itemMap.put("cBatchProperty9",map.get("cVenAbbName")+":"+map.get("cOrderCode"));//供应商
|
|
|
+ List<Map<String,Object>> listmap=this.baseMapper.getAA_BatchPropertyCount(itemMap);
|
|
|
+ //判断是否查询到数据
|
|
|
+// if(listmap!=null&&listmap.size()>0){
|
|
|
+// //修改
|
|
|
+// if(listmap.size()==1){
|
|
|
+// itemMap.put("cBatchPropertyGUID",listmap.get(0).get("cBatchPropertyGUID"));//ID
|
|
|
+// this.baseMapper.updateAA_BatchPropertyByID(itemMap);
|
|
|
+// }else{
|
|
|
+// message=message+"存货:"+itemMap.get("cInvCode").toString()+"在AA_BatchProperty找到了多条记录";
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// //新增
|
|
|
+// itemMap.put("cBatchPropertyGUID",UUID.randomUUID().toString());//ID
|
|
|
+// this.baseMapper.saveAA_BatchProperty(itemMap);
|
|
|
+// }
|
|
|
return message;
|
|
|
}
|
|
|
|
|
@@ -588,9 +607,12 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
|
|
|
//获取批次属性赋值
|
|
|
public void getcBatchProperty(Map<String,Object> itemMap,Map<String,Object> map){
|
|
|
- itemMap.put("cBatchProperty2",map.get("cBatchProperty2"));//含税单价
|
|
|
- itemMap.put("cBatchProperty8",map.get("cBatchProperty8"));//订单号
|
|
|
- itemMap.put("cBatchProperty9",map.get("cBatchProperty9"));//供应商
|
|
|
+// itemMap.put("cBatchProperty2",map.get("cBatchProperty2"));//含税单价
|
|
|
+// itemMap.put("cBatchProperty8",map.get("cBatchProperty8"));//订单号
|
|
|
+// itemMap.put("cBatchProperty9",map.get("cBatchProperty9"));//供应商
|
|
|
+ itemMap.put("cBatchProperty1",map.get("cBatchProperty1"));//采购单价/含税单价
|
|
|
+ itemMap.put("cBatchProperty2",map.get("cBatchProperty2"));//门幅
|
|
|
+ itemMap.put("cBatchProperty9",map.get("cBatchProperty9"));//供应商:订单号
|
|
|
}
|
|
|
|
|
|
public Object setNull(Object o){
|
|
@@ -781,7 +803,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
|
|
|
}
|
|
|
//由于前期是自己插入U8数据库 后前改变方式先择调用第三方插入接口 所以需要把字段名整体转换成第三方的
|
|
|
- JSONArray resturn =InterfaceConnUtils.doPost(saveTransVouchJSON(transVouchMao,transVouchsList,accID),"http://192.168.1.103:8087/api/U8Server/transvouch_import");
|
|
|
+ JSONArray resturn =InterfaceConnUtils.doPost(saveTransVouchJSON(transVouchMao,transVouchsList,accID),"transvouch_import");
|
|
|
if(resturn.getJSONObject(0).get("Result").equals("T")){
|
|
|
//成功
|
|
|
// String tvCode=resturn.getJSONObject(0).get("U8ReceiptNo")+"";//调拨单号
|
|
@@ -940,6 +962,156 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
|
|
|
return maxId;
|
|
|
}
|
|
|
|
|
|
+ @DS("multi-one")
|
|
|
+ @Override
|
|
|
+ public String saveMaterialIssueDocOne(List<Map<String,Object>> mapList,String caccId,String isMaterialIssueDoc) {
|
|
|
+ return saveMaterialIssueDoc(mapList,caccId,isMaterialIssueDoc);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DS("multi-two")
|
|
|
+ @Override
|
|
|
+ public String saveMaterialIssueDocTwo(List<Map<String,Object>> mapList,String caccId,String isMaterialIssueDoc) {
|
|
|
+ return saveMaterialIssueDoc(mapList,caccId,isMaterialIssueDoc);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DS("multi-three")
|
|
|
+ @Override
|
|
|
+ public String saveMaterialIssueDocThree(List<Map<String,Object>> mapList,String caccId,String isMaterialIssueDoc) {
|
|
|
+ return saveMaterialIssueDoc(mapList,caccId,isMaterialIssueDoc);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //插入材料出库单
|
|
|
+ public String saveMaterialIssueDoc(List<Map<String,Object>> mapList,String accId,String isMaterialIssueDoc){
|
|
|
+ String message="";
|
|
|
+ if(mapList!=null&&mapList.size()>0){
|
|
|
+ for(Map<String,Object> map:mapList){
|
|
|
+ map.put("CACCID",accId);//账套
|
|
|
+ map.put("CVOUCHCODE",map.get("CORDERCODE"));//单号
|
|
|
+ //获取汇率、币种
|
|
|
+ //根据订单号获取委外订单
|
|
|
+ Map<String,Object> OM_MOmainMap=this.baseMapper.getOM_MOmainBycCode(String.valueOf(map.get("CORDERCODE")));
|
|
|
+ if(OM_MOmainMap!=null){
|
|
|
+ map.put("CPERSONCODE",OM_MOmainMap.get("cPersonCode"));//业务员编码
|
|
|
+ map.put("IEXCHRATE",getDecimalNew(String.valueOf(OM_MOmainMap.get("nflat"))).doubleValue());//汇率
|
|
|
+ map.put("CEXCH_NAME",OM_MOmainMap.get("cexch_name"));//币种名称
|
|
|
+ map.put("CDEPCODE",OM_MOmainMap.get("cDepCode"));//部门编码
|
|
|
+ //根据供应商获取原材料仓库
|
|
|
+ String cVenCode=String.valueOf(OM_MOmainMap.get("cVenCode"));//供应商编码
|
|
|
+ if(StringUtils.isNotBlank(cVenCode)){
|
|
|
+ Map<String,Object> whCodeMap= this.baseMapper.getVenCode(cVenCode);
|
|
|
+ if(whCodeMap!=null){
|
|
|
+ //获取供应商简称
|
|
|
+// map.put("cVenAbbName",whCodeMap.get("cVenAbbName"));
|
|
|
+ //获取原材料仓
|
|
|
+ if(whCodeMap.get("cVenDefine1")!=null){
|
|
|
+ String cWhCode=String.valueOf(whCodeMap.get("cVenDefine1"));//原材料仓
|
|
|
+ map.put("CWHCODE",cWhCode);
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("未找到供应商的原材料仓库");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("未找到供应商");
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("未找到订单的供应商");
|
|
|
+ }
|
|
|
+ map.put("CMEMO",OM_MOmainMap.get("cMemo"));//备注
|
|
|
+ map.put("CMAKER","陈创");
|
|
|
+ map.put("CHANDLER","陈创");
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("委外订单没有匹配的订单号");
|
|
|
+ }
|
|
|
+ //子表
|
|
|
+ List<Map<String,Object>> itemMapList=(List<Map<String,Object>>)map.get("DETAILList");
|
|
|
+ if(itemMapList!=null&&itemMapList.size()>0){
|
|
|
+ Integer rowId=1;
|
|
|
+ for(Map<String,Object> itemMap:itemMapList){
|
|
|
+// String moDetailId=String.valueOf(itemMap.get("moDetailId"));//委外订单明细id
|
|
|
+ //获取子件行
|
|
|
+ List<Map<String,Object>> OM_MOMaterialsList= this.baseMapper.getOM_MOMaterials(itemMap);
|
|
|
+ if(OM_MOMaterialsList!=null&&OM_MOMaterialsList.size()>0){
|
|
|
+ if(OM_MOMaterialsList.size()==1){
|
|
|
+ //获取订单的自定义数据
|
|
|
+ getcFree(itemMap, OM_MOMaterialsList.get(0));
|
|
|
+ itemMap.put("AUTOID_PO",OM_MOMaterialsList.get(0).get("MOMaterialsID"));//委外订单自件id
|
|
|
+ itemMap.put("ALLCAUTOIDCOL","MOMaterialsID");//子件id字段名
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("第"+rowId+"行找到多个对应委外订单子件行");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("第"+rowId+"行未找到对应委外订单子件行");
|
|
|
+ }
|
|
|
+ rowId++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理第三方json
|
|
|
+ JSONArray resturn =InterfaceConnUtils.doPost(saveMaterialIssueDocJSON(mapList,accId),"materialout_import");
|
|
|
+ if(resturn.getJSONObject(0).get("Result").equals("T")){
|
|
|
+ //成功
|
|
|
+ }else{//失败
|
|
|
+ //判断是否起启用逻辑
|
|
|
+ if(StringUtils.isNotBlank(isMaterialIssueDoc)&&isMaterialIssueDoc.equals("1")){
|
|
|
+ //如果启用则返回错误信息,接口返回成功结果
|
|
|
+ message=message+resturn.getJSONObject(0).get("Description");
|
|
|
+ }else{//如果未启用正常报错,返回错误信息,接口返回失败结果
|
|
|
+ //失败
|
|
|
+ throw new RuntimeException(resturn.getJSONObject(0).get("Description")+"");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理第三方接口要的json
|
|
|
+ public JSONArray saveMaterialIssueDocJSON(List<Map<String,Object>> mapList,String accID){
|
|
|
+ JSONArray jsonArraySave=new JSONArray();
|
|
|
+ if(mapList!=null&&mapList.size()>0){
|
|
|
+ for(Map<String,Object> map:mapList){
|
|
|
+ //主表
|
|
|
+ JSONObject saveJson=new JSONObject();
|
|
|
+ saveJson.put("CACCID",accID);
|
|
|
+ saveJson.put("CVOUCHCODE",map.get("CVOUCHCODE"));
|
|
|
+ saveJson.put("CBUSTYPE",map.get("CBUSTYPE"));
|
|
|
+ saveJson.put("DDATE",map.get("DDATE"));
|
|
|
+ saveJson.put("CPERSONCODE",map.get("CPERSONCODE"));
|
|
|
+ saveJson.put("CEXCH_NAME",map.get("CEXCH_NAME"));
|
|
|
+ saveJson.put("CDEPCODE",map.get("CDEPCODE"));
|
|
|
+ saveJson.put("CWHCODE",map.get("CWHCODE"));
|
|
|
+ saveJson.put("CRDCODE",map.get("CRDCODE"));
|
|
|
+ saveJson.put("IEXCHRATE",map.get("IEXCHRATE"));
|
|
|
+ saveJson.put("CMEMO",map.get("CMEMO"));
|
|
|
+ saveJson.put("CMAKER",map.get("CMAKER"));
|
|
|
+ saveJson.put("CHANDLER",map.get("CHANDLER"));
|
|
|
+ List<Map<String,Object>> itemMapList=(List<Map<String,Object>>)map.get("DETAILList");
|
|
|
+ //子表
|
|
|
+ if(itemMapList!=null&&itemMapList.size()>0){
|
|
|
+ JSONArray itemJsonArray=new JSONArray();
|
|
|
+ for(Map<String,Object> m:itemMapList){
|
|
|
+ JSONObject saveItemJson=new JSONObject();
|
|
|
+ saveItemJson.put("CINVCODE",m.get("CINVCODE"));
|
|
|
+ saveItemJson.put("IQUNTITY",m.get("IQUNTITY"));
|
|
|
+ saveItemJson.put("CBATCH",m.get("CBATCH"));
|
|
|
+ saveItemJson.put("AUTOID_PO",m.get("AUTOID_PO"));
|
|
|
+ saveItemJson.put("ALLCAUTOIDCOL",m.get("ALLCAUTOIDCOL"));
|
|
|
+ //获取自定义项 自由项 批次项
|
|
|
+ getCDEFINEJson(saveItemJson,m);
|
|
|
+ itemJsonArray.add(saveItemJson);
|
|
|
+ }
|
|
|
+ saveJson.put("DETAILList",itemJsonArray);
|
|
|
+ }
|
|
|
+ jsonArraySave.add(saveJson);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("材料出库单json:"+jsonArraySave.toString());
|
|
|
+ return jsonArraySave;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// public void save(List<Map<String, Object>> mapList,String accID){
|
|
|
// if(mapList!=null&&mapList.size()>0){
|