|
@@ -15,10 +15,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* EmsProdplanRoundWeight服务实现:
|
|
@@ -66,13 +63,21 @@ public class EmsProdplanRoundWeightServiceImpl extends BaseServiceImpl<EmsProdpl
|
|
|
model.setMaterialname(item.getMaterialname());
|
|
|
model.setProdate(item.getProdate());
|
|
|
model.setUnit(item.getUnit());
|
|
|
- EmsProdplanRoundWeight emsProdplanRoundWeight = emsProdplanRoundWeightMapper.selectByPrimaryKey(model.getFid());
|
|
|
- if(emsProdplanRoundWeight != null){
|
|
|
- emsProdplanRoundWeightMapper.updateByPrimaryKeySelective(emsProdplanRoundWeight);
|
|
|
- }
|
|
|
- else {
|
|
|
- emsProdplanRoundWeightMapper.insert(model);
|
|
|
+ //fid有重复
|
|
|
+// EmsProdplanRoundWeight emsProdplanRoundWeight = emsProdplanRoundWeightMapper.selectByPrimaryKey(model.getFid());
|
|
|
+ Map<String,Object> map = new HashMap();
|
|
|
+ map.put("fid",model.getFid());
|
|
|
+ map.put("lcId",model.getLcId());
|
|
|
+ List<EmsProdplanRoundWeight> emsProdplanRoundWeights = emsProdplanRoundWeightMapper.selectByParameters(map);
|
|
|
+ for(EmsProdplanRoundWeight emsProdplanRoundWeight:emsProdplanRoundWeights){
|
|
|
+ if(emsProdplanRoundWeight != null){
|
|
|
+ emsProdplanRoundWeightMapper.updateByPrimaryKeySelective(emsProdplanRoundWeight);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ emsProdplanRoundWeightMapper.insert(model);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -106,5 +111,41 @@ public class EmsProdplanRoundWeightServiceImpl extends BaseServiceImpl<EmsProdpl
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ //获取炼钢计划的重量
|
|
|
+ public void getWeightForLg半年() throws ParseException {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date dt = sdf.parse(DateUtils.dateStr(new Date(), "yyyy-MM-dd"));
|
|
|
+ Calendar rightNow = Calendar.getInstance();
|
|
|
+ rightNow.setTime(dt);
|
|
|
+ rightNow.add(Calendar.DAY_OF_MONTH, -150);
|
|
|
+ Date dt1 = rightNow.getTime();
|
|
|
+ String reStr = sdf.format(dt1);
|
|
|
+ List<LgWeight> lgWeights = lgWeightFeigenService.QueryWeightforRound(reStr, DateUtils.dateStr(new Date(), "yyyy-MM-dd"));
|
|
|
+ lgWeights.forEach(item -> {
|
|
|
+ EmsProdplanRoundWeight model = new EmsProdplanRoundWeight();
|
|
|
+ model.setFid(item.getFid());
|
|
|
+ model.setLcId(item.getRoundid());
|
|
|
+ model.setQty(item.getWeight());
|
|
|
+ model.setMaterialcode(item.getMaterialcode());
|
|
|
+ model.setMaterialname(item.getMaterialname());
|
|
|
+ model.setProdate(item.getProdate());
|
|
|
+ model.setUnit(item.getUnit());
|
|
|
+ //fid有重复
|
|
|
+// EmsProdplanRoundWeight emsProdplanRoundWeight = emsProdplanRoundWeightMapper.selectByPrimaryKey(model.getFid());
|
|
|
+ Map<String,Object> map = new HashMap();
|
|
|
+ map.put("fid",model.getFid());
|
|
|
+ map.put("lcId",model.getLcId());
|
|
|
+ List<EmsProdplanRoundWeight> emsProdplanRoundWeights = emsProdplanRoundWeightMapper.selectByParameters(map);
|
|
|
+ for(EmsProdplanRoundWeight emsProdplanRoundWeight:emsProdplanRoundWeights){
|
|
|
+ if(emsProdplanRoundWeight != null){
|
|
|
+ emsProdplanRoundWeightMapper.updateByPrimaryKeySelective(emsProdplanRoundWeight);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ emsProdplanRoundWeightMapper.insert(model);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
}
|