feat:获取CMMP BOM变更单增加参数,只获取指定类型
This commit is contained in:
parent
38a1374d36
commit
6ab7f7e856
@ -2,6 +2,7 @@ package com.yem.em.task;
|
||||
|
||||
import com.yem.em.utils.AtlasUtils;
|
||||
import com.yem.wm.utils.RequestCmmp;
|
||||
import com.yem.wm.utils.YEM;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.exception.KDException;
|
||||
@ -9,6 +10,7 @@ import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.schedule.executor.AbstractTask;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@ -24,22 +26,58 @@ import static com.yem.em.utils.AtlasUtils.seelctDyn;
|
||||
public class BomChangeTaskEdit extends AbstractTask {
|
||||
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
||||
Map<String, String> productmap = new HashMap<>();
|
||||
productmap.put("ZZJ", "L");//装载机
|
||||
productmap.put("CC", "F");//叉车
|
||||
productmap.put("TLJ", "T");//拖拉机
|
||||
if (map.containsKey("product_type")) {
|
||||
Object productType = map.get("product_type");
|
||||
if (YEM.isNotEmpty(productType) && productType instanceof String) {
|
||||
String typeStr = String.valueOf(productType);
|
||||
if (StringUtils.containsIgnoreCase(typeStr, "ZZJ")) {
|
||||
productmap.put("ZZJ", "L");
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(typeStr, "CC")) {
|
||||
productmap.put("CC", "F");
|
||||
}
|
||||
if (StringUtils.containsIgnoreCase(typeStr, "TLJ")) {
|
||||
productmap.put("TLJ", "T");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (map.entrySet().isEmpty()) {
|
||||
productmap.put("ZZJ", "L");//装载机
|
||||
productmap.put("CC", "F");//叉车
|
||||
productmap.put("TLJ", "T");//拖拉机
|
||||
}
|
||||
|
||||
QFilter qFilter = new QFilter("number", QCP.equals, "110");
|
||||
DynamicObject bos_org = BusinessDataServiceHelper.loadSingle("bos_org", "id", qFilter.toArray());
|
||||
String Queryfield = AtlasUtils.Queryfield("changebill_code", "pcode", "ccode", "qty", "break_flag", "enable_time",
|
||||
String Queryfield = AtlasUtils.Queryfield("changebill_code", "pcode", "ccode", "qty", "break_flag", "complete_time",
|
||||
"disable_time", "state", "complete_time", "complete_user", "MATER_NAME", "CMATER_NAME", "COMPLETE_TIME");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String format = f.format(calendar.getTime());
|
||||
|
||||
// 昨天
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||
|
||||
// 获取昨天的00:00:00
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
String start = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
|
||||
|
||||
// 获取昨天的23:59:59
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendar.set(Calendar.MINUTE, 59);
|
||||
calendar.set(Calendar.SECOND, 59);
|
||||
calendar.set(Calendar.MILLISECOND, 999);
|
||||
String end = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
|
||||
|
||||
// start = "2024-12-04 00:00:00";
|
||||
// end = "2024-12-10 23:59:59";
|
||||
|
||||
for (String key : productmap.keySet()) {
|
||||
String value = productmap.get(key);
|
||||
String sql = "select distinct " + Queryfield + " from VIEW_CHANGEBILL_WM " +
|
||||
"where TO_CHAR (enable_time, 'yyyy-mm-dd') >= '" + format + "' AND TO_CHAR (enable_time, 'yyyy-mm-dd') <= '" + format + "'";
|
||||
"where TO_CHAR (complete_time, 'yyyy-mm-dd HH:mm:ss') >= '" + start + "' AND TO_CHAR (complete_time, 'yyyy-mm-dd HH:mm:ss') <= '" + end + "'";
|
||||
if (key.equals("ZZJ")) {
|
||||
//装载机
|
||||
sql = sql + " and changebill_code like 'ZD%' or changebill_code like 'JJBOMBG%'";
|
||||
|
Loading…
Reference in New Issue
Block a user