|
@@ -51,73 +51,81 @@ public class TmstruckSelfMachineService implements ITmstruckSelfMachineService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getDeliveryOrder(String orderNumber) {
|
|
|
- //1.根据运输订单号查询主干信息
|
|
|
- Map<String,Object> map = tmstruckLeaveFactoryResultMapper.getDeliveryOrder(orderNumber);
|
|
|
- //备注信息的查找以及修改
|
|
|
- String note=tmstruckLeaveFactoryResultMapper.querynote(orderNumber);
|
|
|
- Date date=tmstruckLeaveFactoryResultMapper.queryDate(orderNumber);
|
|
|
- if (date!=null&&!("".equals(date))){
|
|
|
- map.put("note",note);
|
|
|
- }else {
|
|
|
- String regex="\\d{1,2}\\.\\d{1,2}";
|
|
|
- Pattern pattern=Pattern.compile(regex);
|
|
|
- Matcher matcher=pattern.matcher(note);
|
|
|
- StringBuffer stringBuffer=new StringBuffer();
|
|
|
- stringBuffer.append(note);
|
|
|
- String partOfNote = tmstruckLeaveFactoryResultMapper.querypartOfNote(orderNumber);
|
|
|
- while (matcher.find()){
|
|
|
- String group = matcher.group();
|
|
|
- /*note=note.replace(group,partOfNote);*/
|
|
|
- note=matcher.replaceAll(partOfNote);
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ try {
|
|
|
+ //1.根据运输订单号查询主干信息
|
|
|
+ map = tmstruckLeaveFactoryResultMapper.getDeliveryOrder(orderNumber);
|
|
|
+ //备注信息的查找以及修改
|
|
|
+ String note=tmstruckLeaveFactoryResultMapper.querynote(orderNumber);
|
|
|
+ Date date=tmstruckLeaveFactoryResultMapper.queryDate(orderNumber);
|
|
|
+ if (date!=null&&!("".equals(date))){
|
|
|
+ map.put("note",note);
|
|
|
+ }else {
|
|
|
+ if(note!=null&&!("".equals(note))){
|
|
|
+ String regex="\\d{1,2}\\.\\d{1,2}";
|
|
|
+ Pattern pattern=Pattern.compile(regex);
|
|
|
+ Matcher matcher=pattern.matcher(note);
|
|
|
+ StringBuffer stringBuffer=new StringBuffer();
|
|
|
+ stringBuffer.append(note);
|
|
|
+ String partOfNote = tmstruckLeaveFactoryResultMapper.querypartOfNote(orderNumber);
|
|
|
+ while (matcher.find()){
|
|
|
+ String group = matcher.group();
|
|
|
+ /*note=note.replace(group,partOfNote);*/
|
|
|
+ note=matcher.replaceAll(partOfNote);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ map.put("note","");
|
|
|
+ }
|
|
|
}
|
|
|
- map.put("note",note);
|
|
|
- }
|
|
|
- map.put("orderNumber",orderNumber);
|
|
|
- if(map !=null){
|
|
|
- List<Map<String, Object>> deliveryOrderMaterialList = tmstruckLeaveFactoryResultMapper.getDeliveryOrderMaterial(orderNumber);
|
|
|
- //判断为棒材还是线材
|
|
|
- for (Map<String,Object> map1:deliveryOrderMaterialList){
|
|
|
- BigDecimal materialid = (BigDecimal) map1.get("materialId");
|
|
|
- String materialName =(String) map1.get("materialName");
|
|
|
- map.put("materialName",materialName);
|
|
|
- BigDecimal Bigdecimal1 = tmstruckLeaveFactoryResultMapper.queryNumber(materialid, orderNumber);
|
|
|
- map1.put("materialNumber",Bigdecimal1);
|
|
|
- //判断是实重还是理重的标志
|
|
|
- BigDecimal isPoundSale = (BigDecimal) map1.get("isPoundSale");
|
|
|
- //判断是否为盘螺materialName.contains("盘螺")||materialName.contains("盘元")
|
|
|
- if (isPoundSale !=null && isPoundSale.compareTo(BigDecimal.valueOf(0))==0){
|
|
|
- //根据运输订单号查找实绩重量
|
|
|
- List<Map<String, Object>> netWeightlist = tmstruckLeaveFactoryResultMapper.getNetWeightByOrder(map);
|
|
|
- for (Map<String, Object> stringObjectMap : netWeightlist) {
|
|
|
- BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
|
|
|
- if(materialid1 !=null&&!("".equals(materialid1))){
|
|
|
- if (materialid.compareTo(materialid1) == 0) {
|
|
|
- BigDecimal nowNetWeight = (BigDecimal) stringObjectMap.get("nowNetWeight");
|
|
|
- if (nowNetWeight != null) {
|
|
|
- map1.put("materialWeight", nowNetWeight);
|
|
|
+ map.put("orderNumber",orderNumber);
|
|
|
+ if(map !=null){
|
|
|
+ List<Map<String, Object>> deliveryOrderMaterialList = tmstruckLeaveFactoryResultMapper.getDeliveryOrderMaterial(orderNumber);
|
|
|
+ //判断为棒材还是线材
|
|
|
+ for (Map<String,Object> map1:deliveryOrderMaterialList){
|
|
|
+ BigDecimal materialid = (BigDecimal) map1.get("materialId");
|
|
|
+ String materialName =(String) map1.get("materialName");
|
|
|
+ map.put("materialName",materialName);
|
|
|
+ BigDecimal Bigdecimal1 = tmstruckLeaveFactoryResultMapper.queryNumber(materialid, orderNumber);
|
|
|
+ map1.put("materialNumber",Bigdecimal1);
|
|
|
+ //判断是实重还是理重的标志
|
|
|
+ BigDecimal isPoundSale = (BigDecimal) map1.get("isPoundSale");
|
|
|
+ //判断是否为盘螺materialName.contains("盘螺")||materialName.contains("盘元")
|
|
|
+ if (isPoundSale !=null && isPoundSale.compareTo(BigDecimal.valueOf(0))==0){
|
|
|
+ //根据运输订单号查找实绩重量
|
|
|
+ List<Map<String, Object>> netWeightlist = tmstruckLeaveFactoryResultMapper.getNetWeightByOrder(map);
|
|
|
+ for (Map<String, Object> stringObjectMap : netWeightlist) {
|
|
|
+ BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
|
|
|
+ if(materialid1 !=null&&!("".equals(materialid1))){
|
|
|
+ if (materialid.compareTo(materialid1) == 0) {
|
|
|
+ BigDecimal nowNetWeight = (BigDecimal) stringObjectMap.get("nowNetWeight");
|
|
|
+ if (nowNetWeight != null) {
|
|
|
+ map1.put("materialWeight", nowNetWeight);
|
|
|
+ }
|
|
|
}
|
|
|
+ }else {
|
|
|
+ map1.put("materialWeight", "");
|
|
|
}
|
|
|
- }else {
|
|
|
- map1.put("materialWeight", "");
|
|
|
}
|
|
|
- }
|
|
|
- }else {
|
|
|
- //获取物资理重
|
|
|
- List<Map<String, Object>> theoryWeightlist = tmstruckLeaveFactoryResultMapper.getTheoryWeight(map);
|
|
|
- for (Map<String, Object> stringObjectMap : theoryWeightlist) {
|
|
|
- BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
|
|
|
- if (materialid.compareTo(materialid1) == 0){
|
|
|
- BigDecimal theoryWeight=(BigDecimal) stringObjectMap.get("theoreticalWeight");
|
|
|
- if (theoryWeight != null){
|
|
|
- map1.put("materialWeight",theoryWeight);
|
|
|
+ }else {
|
|
|
+ //获取物资理重
|
|
|
+ List<Map<String, Object>> theoryWeightlist = tmstruckLeaveFactoryResultMapper.getTheoryWeight(map);
|
|
|
+ for (Map<String, Object> stringObjectMap : theoryWeightlist) {
|
|
|
+ BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
|
|
|
+ if (materialid.compareTo(materialid1) == 0){
|
|
|
+ BigDecimal theoryWeight=(BigDecimal) stringObjectMap.get("theoreticalWeight");
|
|
|
+ if (theoryWeight != null){
|
|
|
+ map1.put("materialWeight",theoryWeight);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ map.put("deliveryOrderMaterialList",deliveryOrderMaterialList);
|
|
|
}
|
|
|
- map.put("deliveryOrderMaterialList",deliveryOrderMaterialList);
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println("e"+e.getMessage());
|
|
|
}
|
|
|
-
|
|
|
return map;
|
|
|
}
|
|
|
|