|
@@ -140,7 +140,8 @@ public class AskGoodsServiceImpl implements AskGoodsService {
|
|
|
Inventory inventory = new Inventory()
|
|
|
.setMaterialId(askGoods1.getMaterialId())
|
|
|
.setWbs(askGoods1.getWbs())
|
|
|
- .setCompanyCode(askGoods1.getCompanyNumber());
|
|
|
+ .setCompanyCode(askGoods1.getCompanyNumber())
|
|
|
+ .setGroupBy(askGoods.getGroupBy());
|
|
|
List<Map<String, Object>> inventorVal = queryListMapper.storageLocation(inventory);
|
|
|
if(inventorVal.size() != 0){
|
|
|
mapVal.add(inventorVal.get(0).get("sum").toString());
|
|
@@ -616,13 +617,13 @@ public class AskGoodsServiceImpl implements AskGoodsService {
|
|
|
map.put("errMsg", "未查询到该库位的库存");
|
|
|
return map;
|
|
|
}
|
|
|
- if(Integer.parseInt(inventory.get(0).getAmount()) < Integer.parseInt(askGoods.getNum())){
|
|
|
+ if(Double.parseDouble(inventory.get(0).getAmount()) < Double.parseDouble(askGoods.getNum())){
|
|
|
map.put("msg", "500");
|
|
|
map.put("errMsg", "库存数量不足");
|
|
|
return map;
|
|
|
}
|
|
|
//如果出库库存等于虚拟表库存则删除此库存
|
|
|
- if(Integer.parseInt(askGoods.getNum()) == Integer.parseInt(inventory.get(0).getAmount())){
|
|
|
+ if(Double.parseDouble(askGoods.getNum()) == Double.parseDouble(inventory.get(0).getAmount())){
|
|
|
askGoodsMapper.deleteInventory(inventory.get(0));
|
|
|
} else {
|
|
|
inventory.get(0).setAmount(askGoods.getNum());
|
|
@@ -1220,7 +1221,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
|
|
|
List<JSONObject> list = new LinkedList<>();
|
|
|
for (Map<String, Object> map : askGoodsMapper.getRemovalz(mapList.get(0).get("askGoodsId").toString(),maps.get("warehouseWhere").toString())) {
|
|
|
JSONObject BillItems = new JSONObject();
|
|
|
- BillItems.put("WMSItemID", map.get("id"));//分录ID
|
|
|
+ BillItems.put("WMSItemID", map.get("askId"));//分录ID
|
|
|
BillItems.put("GIReqBillID", map.get("askGoodsId"));//要货申请单ID
|
|
|
BillItems.put("GIReqBillItemID", map.get("entryNumber"));//要货申请明细ID
|
|
|
BillItems.put("Material", map.get("materialId"));//物料id
|
|
@@ -1247,7 +1248,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
|
|
|
//如果失败存入报错信息跟数据
|
|
|
error.setErrorInfo(result.get("data").toString());
|
|
|
error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateMakeUpOtherOutStock");
|
|
|
- error.setDataVal(returnData.toJSONString()).setType("其它入库");
|
|
|
+ error.setDataVal(returnData.toJSONString()).setType("其它出库");
|
|
|
errorMapper.addError(error);
|
|
|
} else {
|
|
|
JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());
|
|
@@ -1256,7 +1257,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
|
|
|
//如果失败存入报错信息跟数据
|
|
|
error.setErrorInfo(jsonObject1.get("Msg").toString());
|
|
|
error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateMakeUpOtherOutStock");
|
|
|
- error.setDataVal(returnData.toJSONString()).setType("其它入库");
|
|
|
+ error.setDataVal(returnData.toJSONString()).setType("其它出库");
|
|
|
errorMapper.addError(error);
|
|
|
} else {
|
|
|
List<JSONObject> data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
|
|
@@ -1267,7 +1268,110 @@ public class AskGoodsServiceImpl implements AskGoodsService {
|
|
|
//如果失败存入报错信息跟数据
|
|
|
error.setErrorInfo(map.get("FailReason").toString());
|
|
|
error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateMakeUpOtherOutStock");
|
|
|
- error.setDataVal(jsonObject2.toString()).setType("其它入库");
|
|
|
+ error.setDataVal(jsonObject2.toString()).setType("其它出库");
|
|
|
+ errorMapper.addError(error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //删除父子表信息
|
|
|
+// askGoodsMapper.delPlugOutRemoval(removalCode);
|
|
|
+// askGoodsMapper.delRemovalz(removalCode);
|
|
|
+ //添加记录到tld_access
|
|
|
+ String names = "其它出库";
|
|
|
+ String accessType = "1";
|
|
|
+ String returnGsRemoval = returnData.toString();
|
|
|
+ askGoodsMapper.addAccess(names, returnGsRemoval, accessType);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 其他发货(参照要货申请制单(其他发货通知_青岛工厂))接口文档
|
|
|
+ * @Param: removalCode
|
|
|
+ * @return: void
|
|
|
+ * @Author: XiaoChen
|
|
|
+ * @Date: 2023/4/14
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void CreateOtherDeliveryMaterial(String removalCode) {
|
|
|
+ try {
|
|
|
+ JSONObject returnData = new JSONObject();
|
|
|
+ List<JSONObject> retunList = new LinkedList<>();
|
|
|
+ LinkedList<String> noticeIds = new LinkedList<>();
|
|
|
+ //通过出库单编号查询单据ID
|
|
|
+ List<Map<String,Object>> lists = askGoodsMapper.getCreateOtherDeliveryMaterialsWarehouseWhere(removalCode);
|
|
|
+ //根据id查询子表的供货仓库
|
|
|
+ //根据仓库循环
|
|
|
+ for (Map<String, Object> maps : lists) {
|
|
|
+ List<Map<String, Object>> mapList = askGoodsMapper.getGsRemoval(removalCode);
|
|
|
+ if(mapList.size() >0 ) {
|
|
|
+ JSONObject strJson = new JSONObject();
|
|
|
+ //父表
|
|
|
+ strJson.put("GIReqBillID", mapList.get(0).get("askGoodsId").toString());//要货单id
|
|
|
+ strJson.put("WMSID", mapList.get(0).get("id").toString());//出库单id
|
|
|
+ strJson.put("WMSCode", mapList.get(0).get("removalCode").toString());//出库单编号
|
|
|
+ strJson.put("WareHouse", maps.get("warehouseWhere"));//仓库ID
|
|
|
+ strJson.put("SourceBillDate",DateUtil.dateConversion(mapList.get(0).get("scrq").toString()));//业务日期
|
|
|
+ strJson.put("SourceType", mapList.get(0).get("sourceType").toString());//来源类型
|
|
|
+ strJson.put("MoveType", mapList.get(0).get("moveType").toString());//移动类型
|
|
|
+ strJson.put("IsRed", 0);//是否红单1
|
|
|
+ strJson.put("Creator", "测试");//制单人姓名1
|
|
|
+ //子表
|
|
|
+ List<JSONObject> list = new LinkedList<>();
|
|
|
+ for (Map<String, Object> map : askGoodsMapper.getRemovalz(mapList.get(0).get("askGoodsId").toString(),maps.get("warehouseWhere").toString())) {
|
|
|
+ JSONObject BillItems = new JSONObject();
|
|
|
+ BillItems.put("WMSItemID", map.get("askId"));//分录ID
|
|
|
+ BillItems.put("GIReqBillID", map.get("askGoodsId"));//要货申请单ID
|
|
|
+ BillItems.put("GIReqBillItemID", map.get("entryNumber"));//要货申请明细ID
|
|
|
+ BillItems.put("Material", map.get("materialId"));//物料id
|
|
|
+ BillItems.put("Quantity", map.get("num"));//数量
|
|
|
+ BillItems.put("FlexField1", map.get("wbsId"));//wbs
|
|
|
+ BillItems.put("FlexField1Code", map.get("wbsCode"));//WBS编号
|
|
|
+ BillItems.put("FlexField1Name", map.get("wbsName"));//WBS名称
|
|
|
+ list.add(BillItems);
|
|
|
+ }
|
|
|
+ strJson.put("BillItems", list);
|
|
|
+ retunList.add(strJson);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ JSONObject ReqOutStocks = new JSONObject();
|
|
|
+ ReqOutStocks.put("ReqOutStocks", retunList);
|
|
|
+ List<JSONObject> retunList1 = new LinkedList<>();
|
|
|
+ returnData.put("strJson", JSON.toJSONString(ReqOutStocks));
|
|
|
+ System.out.println(returnData);
|
|
|
+ HttpClientUtil httpClientUtil1 = new HttpClientUtil();
|
|
|
+ Map<String, Object> result = httpClientUtil1.doPost("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateOtherOutStock", returnData);
|
|
|
+ System.out.println("result:" + result);
|
|
|
+ Error error = new Error();
|
|
|
+ if (Integer.parseInt(result.get("msg").toString()) != 200) {
|
|
|
+ //如果失败存入报错信息跟数据
|
|
|
+ error.setErrorInfo(result.get("data").toString());
|
|
|
+ error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateOtherOutStock");
|
|
|
+ error.setDataVal(returnData.toJSONString()).setType("其它出库");
|
|
|
+ errorMapper.addError(error);
|
|
|
+ } else {
|
|
|
+ JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());
|
|
|
+ JSONObject jsonObject1 = (JSONObject) JSONObject.parse(jsonObject.get("result").toString());
|
|
|
+ if (jsonObject1.get("State").toString().equals("0")) {
|
|
|
+ //如果失败存入报错信息跟数据
|
|
|
+ error.setErrorInfo(jsonObject1.get("Msg").toString());
|
|
|
+ error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateOtherOutStock");
|
|
|
+ error.setDataVal(returnData.toJSONString()).setType("其它出库");
|
|
|
+ errorMapper.addError(error);
|
|
|
+ } else {
|
|
|
+ List<JSONObject> data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
|
|
|
+ for (JSONObject map : data1) {
|
|
|
+ if (map.get("State").toString().equals("0")) {
|
|
|
+ for (JSONObject jsonObject2 : retunList) {
|
|
|
+ if (jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))) {
|
|
|
+ //如果失败存入报错信息跟数据
|
|
|
+ error.setErrorInfo(map.get("FailReason").toString());
|
|
|
+ error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateOtherOutStock");
|
|
|
+ error.setDataVal(jsonObject2.toString()).setType("其它出库");
|
|
|
errorMapper.addError(error);
|
|
|
}
|
|
|
}
|