Commit 36353c81 by liuyang

2024-08-27 生产计划添加排产功能

parent 384fc5c1
......@@ -157,7 +157,7 @@ public class HPSC004 extends DaoEPBase {
private BigDecimal actualCompletionNum = new BigDecimal("0"); /* 实际完工数量*/
private BigDecimal actualCompletionUnitWt = new BigDecimal("0"); /* 实际完工重量*/
private Long inventRecordId; /* 项目档案ID*/
private Integer status; /* 状态 0-未审核,1-已审核*/
private Integer status = 0; /* 状态 0-未审核,1-已审核*/
private String remark = " "; /* 备注*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
......@@ -165,7 +165,7 @@ public class HPSC004 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer delStatus; /* 状态:0未删除,1已删除*/
private Integer delStatus = 0; /* 状态:0未删除,1已删除*/
private String deliveryDate = " ";
private String factoryCode = " "; /* 工厂代码*/
......
......@@ -54,6 +54,7 @@ public class ServiceHPSC003 extends ServiceBase {
* @return
*/
@OperationLogAnnotation(operModul = "生产计划",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID,DdynamicEnum.INVENT_NAME_BLOCK_ID),
new HashMap<String,Object>(){{put("inventType",4);}});
......@@ -119,6 +120,7 @@ public class ServiceHPSC003 extends ServiceBase {
* 修改操作.
*/
@OperationLogAnnotation(operModul = "生产计划",operType = "修改",operDesc = "修改")
@Override
public EiInfo update(EiInfo inInfo) {
try {
HPSC003 hpsc003 = new HPSC003();
......@@ -391,6 +393,39 @@ public class ServiceHPSC003 extends ServiceBase {
}
}
}
@OperationLogAnnotation(operModul = "生产计划", operType = "排产", operDesc = "提交排产")
public EiInfo submitProduc(EiInfo inInfo) {
try {
List<HPSC003> hpsc003s = MapUtils.toDaoEPBases(inInfo, HPSC003.class);
for (HPSC003 hpsc003 : hpsc003s) {
List<HPSC004> hpsc004s = HPSCTools.HpSc004.queryByParent(hpsc003.getPlanInfoNo());
for (HPSC004 hpsc004:hpsc004s) {
String startDate =handleEndDate(hpsc004.getPlanCommentDate());
String endDate =handleEndDate(hpsc004.getPlanCompletionDate());
hpsc004.setPlanCommentDate(startDate);
hpsc004.setPlanCompletionDate(endDate);
DaoUtils.update(HPSC004.UPDATE, hpsc004);
}
String planCompletionDate =handleEndDate(hpsc003.getPlanCompletionDate());
hpsc003.setPlanCompletionDate(planCompletionDate);
DaoUtils.update(HPSC003.UPDATE, hpsc003);
}
}catch (PlatException e){
LogUtils.setMsg(inInfo,e,"提交排产失败");
}
return inInfo;
}
/**
* 处理计划完成日期
* @param endDate 计划完成日期
* @return 处理后的计划完成日期减3天
*/
private static String handleEndDate(String endDate){
if(StringUtils.isNotBlank(endDate)){
endDate = DateUtils.toDateStr(DateUtils.addDays(DateUtils.toDate(endDate,DateUtils.DATE8_PATTERN),-3),DateUtils.DATE8_PATTERN);
}
return endDate;
}
}
......@@ -40,6 +40,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static final DateTimeFormatter YEAR_MONTH = DateTimeFormatter.ofPattern("yyyy-MM");
public static final DateTimeFormatter CHINA_DATE = DateTimeFormatter.ofPattern("yyyy年MM月dd月");
public static final String DATE8_PATTERN = "yyyyMMdd";
public static final String DATE10_PATTERN = "yyyy-MM-dd";
/**
* 获取上个月的1号日期
......
......@@ -66,6 +66,10 @@ $(function () {
pageOffset = e.page;
console.log(e.page);
},
loadComplete: function (grid) {
//此grid对象
$("#SUBMIT_PRODUC").on("click",submitProduc);
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
......@@ -462,3 +466,40 @@ let imgClick = function (docId) {
$(this).fadeOut("fast");
});
}
/*排产*/
let submitProduc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("status");
if(status == "1"){
message("选中的第"+(index+1)+"行\"任务已提交\",不能排产!");
flag = false;
return false;
}
});
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"排产\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC003", "submitProduc", true,
function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
query();
} else {
NotificationUtil(ei, "error");
}
})
}
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment