|
@@ -12,6 +12,7 @@ import com.steerinfo.dil.service.ITmstruckMeasureCommissionService;
|
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
import com.steerinfo.dil.util.HTTPRequestUtils;
|
|
|
import com.sun.java.swing.plaf.motif.MotifMenuBarUI;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.net.Inet4Address;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -61,6 +63,30 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
//给达兴发委托
|
|
|
private static final List<Integer> judgeDaXinNum = Arrays.asList(7, 18);
|
|
|
|
|
|
+ private static final String judgeCoke = "一厂焦炭库";
|
|
|
+
|
|
|
+ //根据门来判断委托发送依据
|
|
|
+ private static final List<Integer> daGangGatepost = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 14);
|
|
|
+ private static final List<Integer> daXingGatepost = Arrays.asList(8, 9, 10, 11, 12, 13);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据门岗发送委托
|
|
|
+ * @Author TXF
|
|
|
+ * @Date 2022/3/15 11:14
|
|
|
+ * @param map
|
|
|
+ * @return
|
|
|
+ **/
|
|
|
+ public int sendMeasureCommissionByGatepost(Map<String, Object> map){
|
|
|
+ int gatepostId = DataChange.dataToBigDecimal(map.get("gatepostId")).intValue();
|
|
|
+ if(daGangGatepost.contains(gatepostId)){ //给达钢发送委托
|
|
|
+ return sendMeasureCommissionMes(map);
|
|
|
+ }else if(daXingGatepost.contains(gatepostId)){ //给达兴发送委托
|
|
|
+ return sendDXMeasureCommissionMes(map);
|
|
|
+ }
|
|
|
+ return -2; //返回-2为没有获取到门岗ID
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 查询计量委托 0 :计皮 1:计毛
|
|
|
* @param map orderTypee 订单类型 type 是计皮还是计毛
|
|
@@ -111,7 +137,13 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
int i = 0;
|
|
|
//发送数据给计量系统 必要数据 orderTypee:订单类型 resultTotalId: 总实绩Id orderId
|
|
|
//获取当前订单是属于哪个厂区订单
|
|
|
- Integer shipperId = tmstruckMeasureCommissionMapper.getShipperIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ Map<String, Object> mesMap = tmstruckMeasureCommissionMapper.getShipperIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ if(map.get("saleWarehouse") != null){
|
|
|
+ if(judgeCoke.equals(map.get("saleWarehouse"))){ //如果是一厂焦炭库则向达钢发送委托
|
|
|
+ return sendMeasureCommissionMes(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int shipperId = DataChange.dataToBigDecimal(mesMap.get("shipperId")).intValue();
|
|
|
if(shipperId == 1){
|
|
|
//发送委托给达州钢铁
|
|
|
i += sendMeasureCommissionMes(map);
|
|
@@ -129,7 +161,7 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
* @return
|
|
|
*/
|
|
|
public int addLXMeasureCommission(Map<String, Object> map){
|
|
|
- Integer orderType = DataChange.dataToBigDecimal(map.get("orderTypee")).intValue();
|
|
|
+ int orderType = DataChange.dataToBigDecimal(map.get("orderTypee")).intValue();
|
|
|
BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
|
|
|
int i = 0;
|
|
|
if(orderType == 12) {
|
|
@@ -216,7 +248,7 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
public int sendMeasureCommissionMes(Map<String, Object> map){
|
|
|
Map<String, Object> measureCommission = null;
|
|
|
//查询计量委托
|
|
|
- Integer orderType = DataChange.dataToBigDecimal(map.get("orderTypee")).intValue();
|
|
|
+ int orderType = DataChange.dataToBigDecimal(map.get("orderTypee")).intValue();
|
|
|
switch (orderType){
|
|
|
case 1:
|
|
|
break;
|
|
@@ -269,48 +301,26 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
measureCommission.put("packagesNum", 0);
|
|
|
break;
|
|
|
case 12:
|
|
|
- case 13:
|
|
|
- //内转零星进厂(老厂区)
|
|
|
- //零星计量委托(老厂区)
|
|
|
- measureCommission = tmstruckMeasureCommissionMapper.sproadicMeasure(map);
|
|
|
- if(measureCommission == null){
|
|
|
- return 0;
|
|
|
- }
|
|
|
- measureCommission.put("isRelationEAS",false);
|
|
|
- measureCommission.put("flowTo","进厂");
|
|
|
- measureCommission.put("isDel", false);
|
|
|
- measureCommission.put("isInsert", true);
|
|
|
- measureCommission.put("IsAssembly", false);
|
|
|
- measureCommission.put("deliveryMethod", "磅重交货");
|
|
|
- measureCommission.put("packagesNum", 0);
|
|
|
- break;
|
|
|
- case 15:
|
|
|
- //零星计量委托(老厂区) 会有多拼
|
|
|
+ case 13: //零星进厂、出厂
|
|
|
+ case 14:
|
|
|
measureCommission = tmstruckMeasureCommissionMapper.sproadicMeasure(map);
|
|
|
if(measureCommission == null){
|
|
|
return 0;
|
|
|
}
|
|
|
+ measureCommission.put("steelyardNum", "null");
|
|
|
+ measureCommission.put("demo", "无");
|
|
|
measureCommission.put("isRelationEAS",false);
|
|
|
- measureCommission.put("flowTo","进厂");
|
|
|
- measureCommission.put("isDel", false);
|
|
|
- measureCommission.put("isInsert", true);
|
|
|
- measureCommission.put("deliveryMethod", "磅重交货");
|
|
|
- measureCommission.put("packagesNum", 0);
|
|
|
- System.out.println(measureCommission);
|
|
|
- break;
|
|
|
- case 16:
|
|
|
- //零星计量委托(老厂区) 会有多拼
|
|
|
- measureCommission = tmstruckMeasureCommissionMapper.sproadicMeasure(map);
|
|
|
- if(measureCommission == null){
|
|
|
- return 0;
|
|
|
+ if(orderType == 12){
|
|
|
+ measureCommission.put("flowTo","进厂");
|
|
|
+ }else if(orderType == 13){
|
|
|
+ measureCommission.put("flowTo","出厂");
|
|
|
+ }else {
|
|
|
+ measureCommission.put("flowTo","中转");
|
|
|
}
|
|
|
- measureCommission.put("isRelationEAS",false);
|
|
|
- measureCommission.put("flowTo","出厂");
|
|
|
measureCommission.put("isDel", false);
|
|
|
measureCommission.put("isInsert", true);
|
|
|
measureCommission.put("deliveryMethod", "磅重交货");
|
|
|
measureCommission.put("packagesNum", 0);
|
|
|
- System.out.println(measureCommission);
|
|
|
break;
|
|
|
case 20://采购内转委托总厂区
|
|
|
measureCommission=tmstruckMeasureCommissionMapper.purchaseXqCgNzMeasure(map);
|
|
@@ -327,9 +337,10 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
if(measureCommission != null)
|
|
|
map.put("materialId", measureCommission.get("materialId"));
|
|
|
addMeasureCommission(map); // 添加计量委托
|
|
|
-
|
|
|
+ System.out.println(measureCommission);
|
|
|
+ return 1;
|
|
|
/*访问接口发送数据*/
|
|
|
- return sendMesToMeasure(measureCommission);
|
|
|
+// return sendMesToMeasure(measureCommission);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -387,10 +398,9 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
}
|
|
|
measureCommission.put("ended", "0");
|
|
|
break;
|
|
|
- case 12:
|
|
|
+ case 12: // 零星订单
|
|
|
case 13:
|
|
|
- case 15:
|
|
|
- case 16:
|
|
|
+ case 14:
|
|
|
measureCommission = tmstruckMeasureCommissionMapper.sporadicDXMeasure(map);
|
|
|
if(measureCommission == null)
|
|
|
return 0;
|
|
@@ -407,8 +417,10 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
if(measureCommission != null)
|
|
|
map.put("materialId", measureCommission.get("item"));
|
|
|
addMeasureCommission(map); // 添加计量委托
|
|
|
+ System.out.println(measureCommission);
|
|
|
+ return 1;
|
|
|
/*访问接口发送数据*/
|
|
|
- return sendMesToDXMeasure(measureCommission);
|
|
|
+// return sendMesToDXMeasure(measureCommission);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -479,7 +491,9 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
int i=0;
|
|
|
//获取订单类型
|
|
|
BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
|
|
|
- map.putAll(utilsMapper.getOrderMesByOrderId(orderId));
|
|
|
+ if(map.get("materialId") == null){
|
|
|
+ map.putAll(utilsMapper.getOrderMesByOrderId(orderId));
|
|
|
+ }
|
|
|
BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
|
//根据运输订单id查找运输订单号
|
|
|
switch (orderType.intValue()){
|
|
@@ -495,6 +509,26 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
break;
|
|
|
case 12:
|
|
|
case 13:
|
|
|
+ //如果是自动发送委托 查询最近进厂的门岗
|
|
|
+ if(map.get("materialId") != null){
|
|
|
+ Integer gatepostId = utilsMapper.getLastGatepostId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
+ if(gatepostId == null){
|
|
|
+ map.put("gatepostId", 1); //一般零星多拼只存在于老厂
|
|
|
+ }else {
|
|
|
+ map.put("gatepostId", gatepostId);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //手动发送委托
|
|
|
+ Integer materialId = utilsMapper.getNextMaterialId(orderId);
|
|
|
+ if(materialId == null) {
|
|
|
+ return 0;
|
|
|
+ }else {
|
|
|
+ map.put("materialId", materialId);
|
|
|
+ map.put("gatepostId", 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ i+=sendMeasureCommissionByGatepost(map);
|
|
|
+ break;
|
|
|
case 15:
|
|
|
case 20:
|
|
|
case 16: //发送计量委托(查询物资顺序第一个装卸货的物资)
|