Commit adabd3b2 by 江和松

Merge remote-tracking branch 'origin/dev' into dev

parents 0574c543 9d0386d7
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
/**
......@@ -19,7 +30,6 @@ public class ServiceHGSC006A extends ServiceBase {
@OperationLogAnnotation(operModul = "生产订单详情", operType = "查询", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) {
try {
String planCode = inInfo.getCellStr(EiConstant.queryBlock,0,HGSC006A.FIELD_order_code);
inInfo = super.query(inInfo, HGSC006A.QUERY, new HGSC006A());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -38,15 +48,72 @@ public class ServiceHGSC006A extends ServiceBase {
return inInfo;
}
@OperationLogAnnotation(operModul = "生产订单详情", operType = "派工", operDesc = "派工")
@OperationLogAnnotation(operModul = "生产订单详情", operType = "批量派工", operDesc = "批量派工")
public EiInfo assign(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC005A.QUERY, new HGSC005A());
String orderCode = inInfo.getString("orderCode");
String[] orderDetailIds = inInfo.getString("ids").split(",");
String factoryCode = inInfo.getString("factoryCode");
String factoryName = inInfo.getString("factoryName");
String groupCode = inInfo.getString("groupCode");
String groupName = inInfo.getString("groupName");
HGSC006 hgsc006 = HGSCTools.THGSC006.getByOrderCode(orderCode);
for (String orderDetailId : orderDetailIds) {
// 校验主订单是否已分派
HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(Long.parseLong(orderDetailId));
// 锁主单号
HGSCTools.THGSC006A.lock(hgsc006A.getId());
AssignStatusEnum assignStatusEnum = AssignStatusEnum.getEnumByCode(hgsc006A.getAssignStatus());
Integer assignQuantity = new Integer(0);
switch (assignStatusEnum){
case UNASSIGN:
assignQuantity = hgsc006A.getQuantity();
HGSCTools.checkAssignedNum(hgsc006A.getId(), hgsc006A.getQuantity());
break;
case PARTIAL_ASSIGN:
assignQuantity = hgsc006A.getUnassignQuantity();
HGSCTools.checkAssignedNum(hgsc006A.getId(), hgsc006A.getUnassignQuantity());
break;
case ASSIGNED:
AssertUtils.isTrue(true,String.format("生产订单[%s]%s已全部分派,不能在进行批量分派,请检查!",hgsc006A.getProcessName(), hgsc006A.getProductName()));
break;
default:
throw new PlatException(String.format("生产订单[%s]%s状态异常,请联系管理员!",hgsc006A.getProcessName(), hgsc006A.getProductName()));
}
// 写入子表数据
HGSC007 hgsc007 = new HGSC007();
BeanUtils.copyProperties(hgsc006A,hgsc007);
cleanBaseInfo(hgsc007);
hgsc007.setTaskCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC007_TASCK_CODE));
hgsc007.setOrderId(hgsc006.getId());
hgsc007.setOrderDetailId(hgsc006A.getId());
hgsc007.setQuantity(assignQuantity);
hgsc007.setTotalWeight(hgsc006A.getSingleWeight().multiply(new BigDecimal(assignQuantity)));
hgsc007.setGroupCode(groupCode);
hgsc007.setGroupName(groupName);
hgsc007.setFactoryCode(factoryCode);
hgsc007.setFactoryName(factoryName);
DaoUtils.insert(HGSC007.INSERT, hgsc007);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据分派成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "分派失败");
}
return inInfo;
}
private void cleanBaseInfo(HGSC007 hgsc007){
hgsc007.setCreatedBy(null);
hgsc007.setCreatedName(null);
hgsc007.setCreatedTime(null);
hgsc007.setUpdatedBy(null);
hgsc007.setUpdatedName(null);
hgsc007.setUpdatedTime(null);
hgsc007.setDepCode(null);
hgsc007.setDepName(null);
hgsc007.setId(null);
HGSC006A a = new HGSC006A();
}
}
......@@ -20,6 +20,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
import java.util.*;
......@@ -180,12 +181,33 @@ public class ServiceHGSC006C extends ServiceBase {
AssertUtils.isEmpty(hgsc007.getGroupCode(), "请选择生产组");
// 更新订单主表数量
HGSCTools.checkAssignedNum(orderDetailId, hgsc007.getQuantity());
hgsc007.setTaskCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC007_TASCK_CODE));
hgsc007.setOrderId(hgsc006.getId());
hgsc007.setMatId(hgsc006.getMatId());
hgsc007.setOrderDetailId(hgsc006A.getId());
hgsc007.setTotalWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(hgsc007.getQuantity())));
DaoUtils.insert(HGSC007.INSERT, hgsc007);
HGSC007 add007 = new HGSC007();
BeanUtils.copyProperties(hgsc006A,add007);
cleanBaseInfo(add007);
add007.setTaskCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC007_TASCK_CODE));
add007.setOrderId(hgsc006.getId());
add007.setOrderDetailId(hgsc006A.getId());
add007.setQuantity(hgsc007.getQuantity());
add007.setTotalWeight(hgsc006A.getSingleWeight().multiply(new BigDecimal(hgsc007.getQuantity())));
add007.setGroupCode(hgsc007.getGroupCode());
add007.setGroupName(hgsc007.getGroupName());
add007.setFactoryCode(hgsc007.getFactoryCode());
add007.setFactoryName(hgsc007.getFactoryName());
DaoUtils.insert(HGSC007.INSERT, add007);
}
private void cleanBaseInfo(HGSC007 hgsc007){
hgsc007.setCreatedBy(null);
hgsc007.setCreatedName(null);
hgsc007.setCreatedTime(null);
hgsc007.setUpdatedBy(null);
hgsc007.setUpdatedName(null);
hgsc007.setUpdatedTime(null);
hgsc007.setDepCode(null);
hgsc007.setDepName(null);
hgsc007.setId(null);
HGSC006A a = new HGSC006A();
}
/**
......
......@@ -480,6 +480,12 @@
assign_status = #assignStatus#, <!-- 派工状态 0待派工;1部分派工;2已派工 -->
assign_quantity = #assignQuantity#, <!-- 派工数量 -->
unassign_quantity = #unassignQuantity#, <!-- 未派工数量 -->
<isNotEmpty property="assignWeight">
assign_weight = #assignWeight#
</isNotEmpty>
<isNotEmpty property="unassignWeight">
unassign_weight = #unassignWeight#
</isNotEmpty>
<include refid="updateRevise"/>
WHERE id = #id#
</update>
......
......@@ -66,6 +66,11 @@ public class HGSCTools {
updateMap.put(hgsc006A.FIELD_id, hgsc006A.getId());
updateMap.put(HGSC006A.FIELD_quantity, totalNum);
updateMap.put(HGSC006A.FIELD_unassign_quantity, jhNum - totalNum);
if(Objects.nonNull(hgsc006A.getSingleWeight())&&hgsc006A.getSingleWeight().compareTo(BigDecimal.ZERO)>0) {
BigDecimal assignWeight = hgsc006A.getSingleWeight().multiply(new BigDecimal(totalNum));
updateMap.put(HGSC006A.FIELD_assign_weight, assignWeight);
updateMap.put(HGSC006A.FIELD_unassign_weight, hgsc006A.getTotalWeight().subtract(assignWeight));
}
// 0.未派工,1.部分派工,2.全部派工
AssignStatusEnum orderDetailAssignStatus ;
if (jhNum - totalNum==0) {
......
......@@ -49,7 +49,8 @@ function assign() {
message("请至少选择一条需要分派的数据");
return;
}
let productType= rows[0].get("productType");
let productType = rows[0].get("productType");
let orderCode = rows[0].get("orderCode");
let flag = true;
$.each(rows, function(index, item) {
let compareProductType = item.get("productType");
......@@ -74,6 +75,7 @@ function assign() {
callbackName: function (row) {
var info = new EiInfo()
info.set("ids", ids.join(','));
info.set("orderCode",orderCode);
info.set("factoryCode", row.factoryCode);
info.set("factoryName", row.factoryName);
info.set("groupCode", row.groupCode);
......
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