Commit 571a9ee9 by wuwenlong

排产新增按重量计算工时;报工dev

parent 5a8c0799
......@@ -13,7 +13,8 @@ import java.util.Map;
*/
public enum ComputeTypeEnum {
CD(1,"长度"),
SL(2,"数量");
SL(2,"数量"),
ZL(3,"重量");
private Integer code;
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
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.ServiceEPBase;
import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
import java.util.*;
/**
* @author wwl
* @version 1.0 2024/5/24
*/
public class ServiceHGSC007A extends ServiceEPBase {
@OperationLogAnnotation(operModul = "生产任务", operType = "查询", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String taskId = MapUtils.getString(queryMap, HGSC008.FIELD_task_id);
HGSC007 hgsc007 = HGSCTools.THGSC007.getById(Long.valueOf(taskId));
HGSC008 hgsc008 = new HGSC008();
BeanUtils.copyProperties(hgsc007,hgsc008);
List<HGSC008> old008List = HGSCTools.THGSC008.getByTaskId(Long.valueOf(taskId));
hgsc008.setTaskQuantity(hgsc007.getQuantity());
hgsc008.setTaskWeight(hgsc007.getTotalWeight());
hgsc008.setRegisteredQuantity(Optional.ofNullable(old008List).orElse(new ArrayList<>()).stream().mapToInt(HGSC008::getQuantity).sum());
hgsc008.setRegisteredWeight(Optional.ofNullable(old008List).orElse(new ArrayList<>()).stream().map(HGSC008::getTotalWeight).reduce(BigDecimal.ZERO, BigDecimal::add));
hgsc008.setUnregisterQuantity(hgsc007.getQuantity() - hgsc008.getRegisteredQuantity());
hgsc008.setUnregisterWeight(hgsc007.getTotalWeight().subtract(hgsc008.getRegisteredWeight()));
hgsc008.setRegisterDate(DateUtil.toDateStr(new Date(),DateUtil.DATE10_PATTERN));
hgsc008.setQuantity(null);
hgsc008.setTotalWeight(null);
inInfo.addBlock(EiConstant.resultBlock).addRow(hgsc008);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
......@@ -567,6 +567,11 @@ public class HGSCTools {
.divide(timing,2, ROUND_DOWN)
.multiply(baseWorkHour).add(finalRemainder));
break;
case ZL:
workHour.set(planInfo.getTotalWeight().multiply(composingCoeff)
.divide(timing,2, ROUND_DOWN)
.multiply(baseWorkHour).add(finalRemainder));
break;
default:
break;
}
......@@ -733,6 +738,14 @@ public class HGSCTools {
}
public static class THGSC008{
public static List<HGSC008> getByTaskId(Long taskId){
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "生产任务ID不能为空!");
List<HGSC008> results = DaoBase.getInstance().query(HGSC008.QUERY, new HashMap<String,Object>(){{put(HGSC008.FIELD_task_id, taskId);}});
return CollectionUtils.isEmpty(results) ? null : results;
}
}
}
......@@ -54,6 +54,7 @@ function assign() {
let flag = true;
$.each(rows, function(index, item) {
let compareProductType = item.get("productType");
ids.push(item.id)
if(productType != compareProductType){
IPLAT.alert({
message : "选中的生产订单不属于同一工种,无法分派!",
......@@ -70,8 +71,8 @@ function assign() {
JSColorbox.open({
href: "HGSC098?methodName=initLoad&inqu_status-0-companyCode=" + companyCode + "&inqu_status-0-productType=" + productType,
title: "<div style='text-align: center;'>选择组织</div>",
width: "70%",
height: "70%",
width: "90%",
height: "90%",
callbackName: function (row) {
var info = new EiInfo()
info.set("ids", ids.join(','));
......@@ -113,12 +114,12 @@ function separateAssign(orderDetailId){
}
function showTaskInfo(orderDetailId) {
// JSColorbox.open({
// href: "HGSC007?methodName=initLoad&inqu_status-0-orderDetailId=" + orderDetailId + "&efParentFormEname=HGSC006A",
// title: "<div style='text-align: center;'>生产任务详情</div>",
// width: "90%",
// height: "90%"
// });
JSColorbox.open({
href: "HGSC007?methodName=initLoad&inqu_status-0-orderDetailId=" + orderDetailId + "&efParentFormEname=HGSC006A",
title: "<div style='text-align: center;'>生产任务详情</div>",
width: "90%",
height: "90%"
});
}
/**
......
......@@ -14,7 +14,12 @@ $(function () {
{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
let template = '';
if(item.unfinishQuantity>0){
template+='<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="registerWork(' + item.id + ')" >报工</a>';
}
template+='<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.matId + ')" >附件清单</a>';
return template;
}
......@@ -47,3 +52,21 @@ function showUploadFile(id) {
});
}
function registerWork(id) {
JSColorbox.open({
href: "HGSC007A?methodName=initLoad&inqu_status-0-taskId=" + id,
title: "<div style='text-align: center;'>报工</div>",
width: "90%",
height: "40%",
callbackName: registerWorkCallback
});
}
function registerWorkCallback(ei) {
if (ei.getStatus() >= 0) {
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
JSColorbox.close();
}
}
$(function () {
$("#result-0-companyCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-companyCode"));
$("#result-0-companyName").val(textField);
})
$("#result-0-depCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-depCode"));
$("#result-0-depName").val(textField);
});
$("#result-0-subcontractCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-subcontractCode"));
$("#result-0-subcontractName").val(textField);
loadProjMg(IPLAT.EFSelect.value($("#result-0-subcontractCode")));
});
$("#result-0-genralContractCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-genralContractCode"));
$("#result-0-genralContractName").val(textField);
});
/**
* 取消
*/
$('#cancel').on('click', function () {
// 关闭弹窗
parent.JSColorbox.close();
})
/**
* 保存*
*/
$("#btn_save").on("click",function(){
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HGSC001", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
}
});
});
});
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="报工">
<EF:EFRegion id="inqu" title="报工">
<div class="row">
<EF:EFInput ename="result-0-taskId" cname="生产任务ID" type="hidden"/>
<EF:EFInput ename="result-0-productCode" cname="产品编码" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-productName" cname="产品名称" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-processName" cname="工序" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-singleWeight" cname="单重" colWidth="4" format="{0:0.00}" editType="text" readonly="true"/>
<EF:EFInput ename="result-0-orderQuantity" cname="任务数量" format="{0:0}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-orderWeight" cname="任务重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-registeredQuantity" cname="已报工数量" format="{0:0}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-registeredWeight" cname="已报工重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-unregisterQuantity" cname="剩余数量" format="{0:0}" editType="text" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-unregisterWeight" cname="剩余重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-groupName" cname="班组" colWidth="4" required="true" readonly="true"/>
<EF:EFDatePicker cname="报工日期" ename="result-0-registerDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-quantity" cname="报工数量" format="{0:0}" editType="text" colWidth="4" required="true" readonly="false"/>
<EF:EFInput ename="result-0-totalWeight" cname="报工重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
</div>
</EF:EFRegion>
<div class="row" style="display:flex;justify-content:center;">
<EF:EFButton ename="cancel" cname="取消" type="button" class="btn-center"/>
<EF:EFButton ename="btn_save" cname="保存" type="button" class="btn-center"/>
</div>
</EF:EFPage>
......@@ -10,13 +10,13 @@
<EF:EFInput cname="公司编码" ename="companyCode" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="产品类型" ename="productType" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFSelect ename="inqu_status-0-factoryCode" cname="工厂" colWidth="3" filter="contains"
<EF:EFSelect ename="inqu_status-0-factoryCode" cname="工厂" colWidth="4" filter="contains"
template="#=textField#" valueTemplate="#=textField#">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="factoryName" valueField="factoryCode"/>
</EF:EFSelect>
<EF:EFCascadeSelect cascadeFrom="inqu_status-0-factoryCode" cname="工作组" ename="inqu_status-0-groupCode"
colWidth="4" required="true" filter="contains" defaultValue=""
colWidth="4" filter="contains" defaultValue=""
serviceName="HGSC098" methodName="workGroupComboBox" resultId="workGroup"
textField="groupName" valueField="groupCode" >
</EF:EFCascadeSelect>
......
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