Commit 171e7d25 authored by 1650842865's avatar 1650842865

异常原因分类维护界面;品质异常报告模糊查询异常原因分类

parent bc70e7fd
var gridManager = null, refreshFlag = false
$(document).ready(function () {
initUI();
initGrid();
}
);
function initUI() {
UICtrl.initDefaultLayout();
}
function initGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: addHandler,
updateHandler:function (){
updateHandler();
},
deleteHandler: deleteHandler,
impExcelDataHandler:{id:'impExcelData',img:'fa-table',text:'导入数据',click:impExcelDataHandler},
});
gridManager = UICtrl.grid('#maingrid', {
columns: [
{display: "序号(一级分类编码)", name: "reasonType", width: "200", align: "center", type: "string"}
, {display: "标准名称大类(一级分类)", name: "reasonTypeName", width: "200", minWidth: 60, type: "string", align: "center"}
, {display: "问题类型代码(二级分类 )", name: "reasonTypeDetail", width: "200", minWidth: 60, type: "string", align: "center"}
, {display: "问题类型(二级分类 )", name: "reasonTypeDetailName", width: "500", minWidth: 60, type: "string", align: "center"}
],
dataAction: 'server',
url: web_app.name + '/exceptionReasonTypeDetail/slicedExceptionReasonTypeDetailList.ajax?',
toolbar: toolbarOptions,
width: '99.8%',
height: '100%',
pageSize: 100,
heightDiff: -4,
sortName: 'reasonType',
sortOrder: 'asc',
checkbox: true,
usePager: true,
rownumbers: true,
enabledEdit: false,
fixedCellHeight: true,
selectRowButtonOnly: true,
enableObjectBag: true,
allowAdjustColWidth: true,
onDblClickRow: function (data, rowindex, rowobj) {
updateHandler(data.id);
},
}
);
UICtrl.setSearchAreaToggle(gridManager);
}
//添加按钮
function addHandler() {
UICtrl.showAjaxDialog({url: web_app.name + '/exceptionReasonTypeDetail/showInsertExceptionReasonTypeDetail.load',
ok: insert, close: dialogClose,width:750,title:'新增'
});
}
//编辑按钮
function updateHandler(id){
if(!id){
var id = DataUtil.getUpdateRowId(gridManager);
if (!id){ return; }
}
UICtrl.showAjaxDialog({url: web_app.name + '/exceptionReasonTypeDetail/showUpdateExceptionReasonTypeDetail.load',
param:{id:id},
ok: update,
width:750,
title:'修改',
close: dialogClose
});
}
//删除按钮
function deleteHandler(){
DataUtil.del({action:'exceptionReasonTypeDetail/deleteExceptionReasonTypeDetail.ajax',
gridManager:gridManager,
onSuccess:function(){
reloadGrid();
}
});
}
function insert() {
var id=$('#id').val();
if(id!='') {
return update();
}
var _self=this;
$('#submitForm').ajaxSubmit({url: web_app.name + '/exceptionReasonTypeDetail/savedExceptionReasonTypeDetail.ajax',
param:{},
success: function(id) {
$('#id').val(id);
_self.close();
gridManager.loadData();
refreshFlag = true;
}
});
}
//编辑保存
function update(){
var _self=this;
$('#submitForm').ajaxSubmit({url: web_app.name + '/exceptionReasonTypeDetail/savedExceptionReasonTypeDetail.ajax',
param:{},
success: function() {
refreshFlag = true;
_self.close();
gridManager.loadData();
}
});
}
//关闭对话框
function dialogClose(){
if(refreshFlag){
reloadGrid();
refreshFlag=false;
}
}
//从EXCEL导入数据
function impExcelDataHandler(){
ExcelImpManager.showImpDialog('导入', 'exceptionReasonTypeDetail', Public.getUUID());
}
function reloadGrid() {
var params = $("#queryMainForm").formToJSON();
UICtrl.gridSearch(gridManager, params);
}
function query(obj) {
var param = $(obj).formToJSON();
UICtrl.gridSearch(gridManager, param);
}
function resetForm(obj) {
$(obj).formClean();
}
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@taglib uri="/WEB-INF/taglib.tld" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<x:base include="layout,dialog,grid,tree,dateTime,combox,attachment,commonTree,comboDialog"/>
<x:script src="/system/excelimport/AssignCodeImp.js"/>
<script src='<c:url value="/biz/topsun/sap/exceptionReport/exceptionReasonTypeDetailList.js"/>' type="text/javascript"></script>
</head>
<body>
<div class="container-fluid">
<div id="layout">
<div position="center" title="">
<x:title title="搜索" hideTable="queryMainForm"/>
<form class="hg-form ui-show" method="post" action="" id="queryMainForm">
<div class="hg-form-row">
<x:inputC name="reasonType" label="序号(一级分类编码)" labelCol="2" fieldCol="2" />
<x:inputC name="reasonTypeName" label="标准名称大类(一级分类)" labelCol="2" fieldCol="4" />
</div>
<div class="hg-form-row">
<x:inputC name="reasonTypeDetail" label="问题类型代码(二级分类 )" labelCol="2" fieldCol="2" />
<x:inputC name="reasonTypeDetailName" label="问题类型(二级分类 )" labelCol="2" fieldCol="4" />
</div>
<x:searchButtons/>
</form>
<x:title title="异常原因分类明细" hideTable="#maingrid" name="list"/>
<div id="maingrid" style="margin:2px;"></div>
</div>
</div>
</div>
</body>
</html>
......@@ -2,7 +2,7 @@ var clientGridManager,produceGridManager, purchaseGridManager, dutyPersonGridMan
$(function () {
initialize();
initSerachBox();
initProduceGrid();
//initProduceGrid();
initClientGrid();
initPurchaseGrid();
initDutyPersonGridGrid();
......@@ -43,9 +43,11 @@ function initialize() {
});
if ($('#exceptionReasonType').val() == "1") {
showPurchaseDiv();
} else if ($('#exceptionReasonType').val() == "2") {
showProduceDiv();
} else {
}
// else if ($('#exceptionReasonType').val() == "2") {
// showProduceDiv();
// }
else {
showClientDiv();
}
$('#exceptionReasonType').combox({
......@@ -54,50 +56,26 @@ function initialize() {
$('#customerName').val("");
$('#customerNo').val("");
if (v.value == 1) { //供应商原料问题
if ($('#exceptionType').val()=="in"){
Public.tip("供应商原料问题的异常类型只能是外部!");
clearExceptionType();
//return false;
}
showPurchaseDiv();
} else {
// if ($('#exceptionType').val()=="out" && v.value== "2"){
// Public.tip("生产异常的异常类型只能是内部!");
// clearExceptionType();
// }
if (v.value== "3"){
checkbox = true
initSerachBox();
showClientDiv();
UICtrl.setElRequiredFlag("#customerNo", true);
//initSerachBox();
//showClientDiv();
//UICtrl.setElRequiredFlag("#customerNo", true);
} else {
checkbox = false
initSerachBox();
UICtrl.setElRequiredFlag("#customerNo", false);
showProduceDiv();
//initSerachBox();
//UICtrl.setElRequiredFlag("#customerNo", false);
//showProduceDiv();
}
UICtrl.setElRequiredFlag("#customerNo", checkbox);
initSerachBox();
showClientDiv();
UICtrl.setElHideOrShow("#loseMoney",false);
}
}
});
$('#exceptionType').combox({
onChange: function (v) {
if (v.value == "in") { //内部
if ($('#exceptionReasonType').val()==1){
Public.tip("供应商原料问题的异常类型只能是外部!");
clearExceptionType();
return false;
}
}
// else {
// if ($('#exceptionReasonType').val()!="" && $('#exceptionReasonType').val()!=1 && $('#exceptionReasonType').val()!=3){
// Public.tip("生产异常的异常类型只能是内部!");
// clearExceptionType();
// return false;
// }
// }
}
});
$('#customerNo').searchbox({
type: "system", name: "dictionary",
......@@ -109,6 +87,19 @@ function initialize() {
$('#customerName').val(data.NAME);
}
});
$('#reasonTypeDetailName').searchbox({
type: "system", name: "selectExceptionReasonTypeDetail",
getParam: function (item) {
return {}
},
onChange: function (value, data) {
$('#reasonTypeName').val(data.reasonTypeName);
$('#reasonTypeDetail').val(data.reasonTypeDetail);
$('#reasonTypeDetailName').val(data.reasonTypeDetailName);
}
});
}
function clearExceptionType(){
......@@ -139,8 +130,8 @@ function showClientDiv() {
$("#purchaseDiv").hide();
$("#produceDiv").show();
$("#clientgridDiv").show();
$("#producegridDiv").hide();
$("#produceNoDiv").show();
//$("#producegridDiv").hide();
//$("#produceNoDiv").show();
$("#customerOrderNo_label").text("客户单号")
try {
clientGridManager.loadData();
......@@ -154,10 +145,6 @@ function showClientDiv() {
function showPurchaseDiv() {
$("#produceDiv").hide();
// var row = purchaseGridManager.rows;
// for (var u = 0; u < row.length; u++) {
// purchaseGridManager.deleteRow(purchaseGridManager.rows[u]);
// }
try {
purchaseGridManager.loadData();
} catch(e){
......@@ -229,19 +216,19 @@ function initSerachBox(){
}
},
onChange: function (value, data) {
if ($('#exceptionReasonType').val()=="3") { //客户异常
//$('#customerName').val(data.NAME1);
// if ($('#exceptionReasonType').val()=="3") { //客户异常
// $('#customerName').val(value.text);
// }
$('#customerName').val(value.text);
}
if ($('#exceptionReasonType').val()=="2"&&data.VBELN!=undefined) { //生产异常
produceGridManager.addRows({
produceNo:data.VBELN,
productCode: data.MATNR,
productName: data.MAKTX,
unitName: data.MEINS,
number: data.PSMNG
});
}
// if ($('#exceptionReasonType').val()=="2"&&data.VBELN!=undefined) { //生产异常
// produceGridManager.addRows({
// produceNo:data.VBELN,
// productCode: data.MATNR,
// productName: data.MAKTX,
// unitName: data.MEINS,
// number: data.PSMNG
// });
// }
$('#customerOrderNo').val(value.value);
}
});
......@@ -462,7 +449,10 @@ function initClientGrid() {
onAfterShowData() {
countSum(clientGridManager.rows);
for (var r = 0; r < clientGridManager.rows.length; r++) {
var money = MathUtil.add(clientGridManager.rows[r].rmbMoney, clientGridManager.rows[r].money);
var money = MathUtil.add(clientGridManager.rows[r].rmbMoney, clientGridManager.rows[r].money)
.add(clientGridManager.rows[r].freight)
.add(clientGridManager.rows[r].rework)
.add(clientGridManager.rows[r].stopWaitMaterial);
clientGridManager.updateRow(clientGridManager.rows[r], {totalMoney:money });
}
}
......@@ -648,6 +638,18 @@ function getClientGridColumns() {
display: "折算金额", name: "rmbMoney", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
} );
columns.push(
{display: "运输费", name: "freight", width: "100", align: "left", type: "string"
,editor: {type: "text",mask: '9999999.999'}
} );
columns.push(
{display: "返工费", name: "rework", width: "100", align: "left", type: "string"
,editor: {type: "text",mask: '9999999.999'}
} );
columns.push(
{display: "停工待料费", name: "stopWaitMaterial", width: "100", align: "left", type: "string"
,editor: {type: "text",mask: '9999999.999'}
} );
columns.push(
{display: "出货日期", name: "sendDate", width: "140", align: "left", type: "date"
,editor: {type: "date"}
......@@ -698,6 +700,18 @@ function getProcduceGridColumns() {
display: "折算金额", name: "rmbMoney", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
{
display: "运输费", name: "freight", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
{
display: "返工费", name: "rework", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
{
display: "停工待料费", name: "stopWaitMaterial", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
// {
// display: "总金额", name: "totalMoney", width: "100", align: "left", type: "string"
// },
......@@ -809,9 +823,15 @@ function initPurchaseGrid() {
//autoApplyNextEditor:false,
toolbar: purchaseToolbarOptions,
onAfterEdit: function (item) {
if (item.column.name == 'rmbMoney') {
if (item.column.name == 'rmbMoney' || item.column.name == 'freight'
|| item.column.name == 'rework' || item.column.name == 'stopWaitMaterial'
|| item.column.name =='startupFee') {
countSum(purchaseGridManager.rows);
var money = MathUtil.add(item.record.money, item.value);
var money = MathUtil.add(item.record.money, item.record.rmbMoney)
.add(item.record.freight)
.add(item.record.rework)
.add(item.record.stopWaitMaterial)
.add(item.record.startupFee);
purchaseGridManager.updateRow(item.record, {totalMoney:money });
}
},
......@@ -929,6 +949,22 @@ function getPurchaseGridColumns() {
display: "罚款金额", name: "rmbMoney", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
{
display: "运输费", name: "freight", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
{
display: "返工费", name: "rework", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
{
display: "停工待料费", name: "stopWaitMaterial", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
{
display: "开机费", name: "startupFee", width: "100", align: "left", type: "string",
editor: {type: "text", mask: '9999999.999'}
},
{
display: "损失总金额", name: "totalMoney", width: "100", align: "left", type: "string"
}
......@@ -946,8 +982,17 @@ function countSum(zrow) {
// var zrow=itemGridManager.rows;
var money = 0;
for (var r = 0; r < zrow.length; r++) {
//客户异常 折算金额+赔付金额=损失金额
if ($('#exceptionReasonType').val() == "3" || $('#exceptionReasonType').val() == "2") {
if (Public.isNotBlank(zrow[r].rmbMoney)) {
money = MathUtil.add(zrow[r].rmbMoney, money);
}else {
money = MathUtil.add(zrow[r].money, money);
}
}else {
money = MathUtil.add(zrow[r].money, money);
}
}
money = MathUtil.add($('#payMoney').val(), money);
// for (var x=0;x<row.length;x++){
// money = MathUtil.add(row[x].dutyMoney,money);
......
......@@ -41,8 +41,10 @@
<x:inputC name="reportDate" label="呈报日期" labelCol="1" fieldCol="2" required="true" wrapper="date"/>
<x:selectC name="urgency" label="紧急程度" labelCol="1" fieldCol="2" required="true" dictionary="urgency"/>
<x:selectC name="exceptionType" label="异常类型" labelCol="1" fieldCol="2" required="true" dictionary="exceptionType"/>
<x:selectC name="exceptionReasonType" label="异常原因分类" labelCol="1" fieldCol="2" required="true" dictionary="exceptionReasonType"/>
<x:selectC name="exceptionReasonType" label="原因分类" labelCol="1" fieldCol="2" required="true" dictionary="exceptionReasonType"/>
<x:inputC name="reasonTypeDetailName" label="异常问题类型" labelCol="1" fieldCol="2" required="true" wrapper="select"/>
<x:hidden name="reasonTypeDetail"/>
<x:hidden name="reasonTypeName"/>
<x:inputC name="productTypeName" label="产品类别" required="false" labelCol="1" fieldCol="2" wrapper="select"/>
<x:hidden name="productType"/>
<!--x:inputC name="appealNo" label="客诉编号" labelCol="1" fieldCol="2" required="false"/-->
......@@ -68,19 +70,21 @@
<div class="hg-form-row">
<x:inputC name="customerNo" label="客户编号" labelCol="1" fieldCol="2" required="false" wrapper="select"/>
<x:inputC name="customerOrderNo" label="客户单号" labelCol="1" fieldCol="2" wrapper="select" required="false"/>
<div id="produceNoDiv">
<x:inputC name="produceNo" label="生产单号" labelCol="1" fieldCol="2" wrapper="select" required="false"/>
</div>
<x:inputC name="customerName" label="客户名称" labelCol="1" fieldCol="2" required="false" readonly="true"/>
</div>
<x:title title="单号信息" name="group" hideTable="#info" />
<div class="hg-form-cols" id="producegridDiv">
<%--<div class="hg-form-cols" id="producegridDiv">
<div id="producegrid"></div>
</div>
</div>--%>
<div class="hg-form-cols" id="clientgridDiv">
<div id="clientgrid"></div>
</div>
</div>
<div class="hg-form-row">
<x:inputC name="payMoney" label="赔付金额" labelCol="1" fieldCol="2" required="false" />
<x:inputC name="loseMoney" label="损失金额" labelCol="1" fieldCol="2" required="false" readonly="true" />
</div>
<div class="hg-form-cols">
<div style="padding-top: 15px;">
......@@ -96,9 +100,9 @@
<x:textareaC name="dealMethod" required="false" label="改善措施" maxLength="1500" labelCol="1" fieldCol="11" rows="3"/>
</div>
<div class="hg-form-row">
<x:inputC name="dutyDeptName" label="责任部门" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:inputC name="dutyDeptName" label="处理部门" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:hidden name="dutyDept"/>
<x:inputC name="checkOperatorName" label="负责人" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:inputC name="checkOperatorName" label="处理人" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:hidden name="checkOperator"/>
</div>
<div class="hg-form-row">
......@@ -115,10 +119,6 @@
</div>
<x:title title="责任人信息" name="group" hideTable="#info" />
<div id="dutyPersonGrid"></div>
<div class="hg-form-row">
<x:inputC name="payMoney" label="赔付金额" labelCol="1" fieldCol="2" required="false" />
<x:inputC name="loseMoney" label="损失金额" labelCol="1" fieldCol="2" required="false" readonly="true" />
</div>
</form>
</div>
</body>
\ No newline at end of file
var itemGridManager,dutyPersonGridManager = null
$(function () {
initialize();
initItemGrid();
initDutyPersonGridGrid();
});
function initialize() {
var mainFileTable = $('#exceptionStateInfoList').fileList();
mainFileTable.find('table').css({
borderTopWidth : 0
});
$('#exceptionStateInfoList').fileList({
bizId : $("#attbizId").val()
});
$("#dutyDeptName").orgTree({
filter: "dpt", excludePos: 0, param: {orgKindId: "ogn,dpt"},
back: {
text: "#dutyDeptName",
value : '#dutyDept'
},
//manageType: 'taskQuery',
onChange:function(value,data){
$('#dutyDept').val(data.id);
}
});
$("#checkOperatorName").orgTree({
filter: "psm", excludePos: 0, param: {orgKindId: "ogn,dpt,pos,psm"},
back: {
text: "#checkOperatorName",
value : '#checkOperator'
},
//manageType: 'taskQuery',
onChange:function(value,data){
// alert(data.id+data.name); alert(data.deptId+data.deptName);
$('#checkOperator').val(data.id);
$('#dutyDeptName').val(data.deptName);
$('#dutyDept').val(data.deptId);
}
});
}
function initItemGrid() {
//工厂
$('#werksName').searchbox({
type: "system", name: "dictionary",
getParam: function (item) {
return {fieldName: "WERKS"}
},
onChange: function (value, data) {
$('#werks').val(data.WERKS);
$('#werksName').val(data.NAME1);
}
});
$('input[name="payMoney"]').change(function () {
if (isNaN(Number($('#payMoney').val()))){
Public.errorTip("赔付金额必须输入数字!");
$('#payMoney').val("");
countSum();
return false;
}
countSum();
})
/*$('#customerName').searchbox({
type: "system", name: "sapCustomerOrderSelect",
getParam: function (item) {
if (Public.isBlank($('#werksName').val())){
Public.tip("请先选择工厂!")
return false
}
return {
werks: $('#werks').val(),
}
},
onChange: function (value, data) {
$('#customerName').val(data.NAME1);
$('#customerNo').val(data.KUNNR);
}
});*/
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function(){
UICtrl.addGridRow(itemGridManager);
},
deleteHandler: function (){
var _grid = UICtrl.getGridManager('#maingrid');
DataUtil.delSelectedRows({
action: 'exceptionReport/deleteExceptionReport.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
onSuccess: function () {
countSum();
reloadGrid();
}
});
},
});
itemGridManager = UICtrl.grid('#maingrid', {
columns: getGridColumns(),
dataAction: 'server',
url: web_app.name + '/exceptionReport/slicedExceptionReportItemList.ajax',
parms: {exceptionReportId: getId()},
height: '300px',
heightDiff: -4,
sortName: 'id',
sortOrder: 'asc',
checkbox: true,
usePager: true,
rownumbers: true,
enabledEdit: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
//autoApplyNextEditor:false,
toolbar: toolbarOptions,
onAfterEdit: function (item) {
if (item.column.name=='rmbMoney' ){
countSum();
}
},
onAfterShowData(){
countSum();
}
})
UICtrl.setSearchAreaToggle(itemGridManager);
}
function getGridColumns() {
var columns = [];
columns = [
{
display: "采购/外发单号", name: "produceNo", width: "160", align: "left", type: "string",
editor: {type: 'text',required:true}
},
{display: "产品类别", name: "productType", width: "160", align: "left", type: "string"
,editor: {type: 'text',required:true}
},
{display: "产品编码", name: "productCode", width: "160", align: "left", type: "string"
,editor: {type: 'text',required:true}
},
{display: "产品名称", name: "productName", width: "200", align: "left", type: "string"
,editor: {type: 'text',required:true}
},
{display: "数量", name: "number", width: "100", align: "left", type: "string"
,editor: {type: "text",mask: '9999999.999'}
},
{display: "单位", name: "unitName", width: "80", align: "left", type: "string"
// ,editor: {type: "text"}
,editor: {
required: true, type: "select",
data: {
type: 'system',
name: "dictionary",
getParam: function (item) {
return {fieldName: "MEINS"}
},
back: {
MSEH3: "unit",
MSEHL: "unitName"
}
},
}
},
{display: "币别", name: "currencyName", width: "100", align: "left", type: "string"
,editor: {type: "text"}
},
{display: "金额", name: "money", width: "100", align: "left", type: "string"
,editor: {type: "text",mask: '9999999.999'}
},
{display: "折算人民币金额", name: "rmbMoney", width: "100", align: "left", type: "string",
editor: {type: "text",mask: '9999999.999'}
},
{display: "出货日期", name: "sendDate", width: "140", align: "left", type: "date"
,editor: {type: "date"}
}
]
return columns;
}
function initDutyPersonGridGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function(){
UICtrl.addGridRow(dutyPersonGridManager);
},
deleteHandler: function (){
var _grid = UICtrl.getGridManager('#dutyPersonGrid');
DataUtil.delSelectedRows({
action: 'exceptionReport/deleteExceptionReportDutyPerson.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
onSuccess: function () {
reloadGrid();
}
});
},
});
dutyPersonGridManager = UICtrl.grid('#dutyPersonGrid', {
columns: getDutyPersonGridColumns(),
dataAction: 'server',
url: web_app.name + '/exceptionReport/slicedExceptionReportDutyPersonList.ajax',
parms:{exceptionReportId:getId()},
height: '300px',
heightDiff: -4,
sortName: 'id',
sortOrder: 'asc',
checkbox: true,
usePager: true,
rownumbers: true,
enabledEdit: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
//autoApplyNextEditor:false,
toolbar: toolbarOptions,
}
);
UICtrl.setSearchAreaToggle(dutyPersonGridManager);
}
function countSum(){
//var row=itemGridManager.rows;
var zrow=itemGridManager.rows;
var money=0;
for (var r=0;r<zrow.length;r++){
money = MathUtil.add(zrow[r].rmbMoney,money);
}
money = MathUtil.add($('#payMoney').val(),money);
// for (var x=0;x<row.length;x++){
// money = MathUtil.add(row[x].dutyMoney,money);
// }
$('#loseMoney').val(money);
}
function getDutyPersonGridColumns() {
var columns = [];
columns = [
{display: "工号/客户编码", name: "personNo", width: "180", align: "left", type: "string",
editor: { type: 'text'}
},
{display: "姓名/客户", name: "personName", width: "180", align: "left", type: "string",
editor: {type: 'text'}
},
{display: "部门/客户名称", name: "deptName", width: "200", align: "left", type: "string",
editor: {type: 'text'}
},
{display: "定责比例(%)", name: "dutyRate", width: "100", align: "left", type: "string",
editor: {type: "text",mask: '999.99'}
},
{display: "个人责任比例(%)", name: "personDutyRate", width: "100", align: "left", type: "string",
editor: {type: "text",mask: '999.99'}
},
{display: "责任金额", name: "dutyMoney", width: "100", align: "left", type: "string",
editor: {type: "text",mask: '9999999.999'}
},
{display: "备注", name: "remark", width: "300", align: "left", type: "string",
editor: {type: "text"}
},
]
return columns;
}
//获取数据保存的参数
function getExtendedData(processAction) {
//回退、打回、转交时,不需要验证必填项是否已经填写;
if (processAction == ProcessAction.BACK
|| processAction == ProcessAction.REPLENISH
|| processAction == ProcessAction.TRANSMIT) {
//不验证
$('#submitForm').attr('check', false);
}
var extendedData = {};
var _grid = UICtrl.getGridManager('#maingrid');
if (_grid) {
var datas = DataUtil.getGridData({
gridManager: _grid,
isAllData: true
});
if (!datas) {
return false;
}
extendedData.exceptionReportItems = Public.encodeJSONURI(datas);
}
var _dutyPersonGrid = UICtrl.getGridManager('#dutyPersonGrid');
if (_dutyPersonGrid) {
var datas = DataUtil.getGridData({
gridManager: _dutyPersonGrid,
isAllData: true
});
if (!datas) {
return false;
}
extendedData.personList = Public.encodeJSONURI(datas);
}
return extendedData;
}
function getId() {
return $('#id').val();
}
function setId(value) {
$("#id").val(value);
var _grid=UICtrl.getGridManager('#maingrid');
_grid.options.parms.exceptionReportId = value;
var _dutyPersonGrid=UICtrl.getGridManager('#dutyPersonGrid');
_dutyPersonGrid.options.parms.exceptionReportId = value;
}
function reloadGrid() {
itemGridManager.loadData();
dutyPersonGridManager.loadData();
countSum();
}
function printPage() {
Public.openPostWindow(web_app.name + '/PDFViewer/PDFViewer.do',{id: $("#id").val(),applicationType:"exceptionReport"});
}
function isNumber(val){
var regPos = /^\+?[1-9][0-9]*$/;
// var regNeg = /^\-[1-9][0-9]*$/; // 负整数
if(regPos.test(val)){
return true;
}else{
return false;
}
}
<%--采购申请--%>
<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ taglib uri="/WEB-INF/taglib.tld" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<x:base include="layout,dialog,grid,tree,dateTime,combox,attachment,commonTree,comboDialog"/>
<x:script src="/biz/topsun/sap/exceptionReport/exceptionReportDetailPurchase.js"/>
</head>
<body>
<div class="container-fluid">
<x:billTitle title="品质异常报告(采购/外发)" needStatus="true" needPerson="true"/>
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="billType"/>
<x:hidden name="id"/>
<x:hidden name="version"/>
<x:hidden name="attbizId"/>
<x:hidden name="billCode"/>
<x:hidden name="fillinDate"/>
<x:hidden name="fullId"/>
<x:hidden name="organId"/>
<x:hidden name="organName"/>
<x:hidden name="deptId"/>
<x:hidden name="deptName"/>
<x:hidden name="positionId"/>
<x:hidden name="positionName"/>
<x:hidden name="personMemberId"/>
<x:hidden name="personMemberName"/>
<x:hidden name="statusId"/>
<x:hidden name="frgdt"/>
<x:hidden name="handleNodeId"/>
<x:hidden name="handleNodeName"/>
<div class="hg-form-cols">
<c:if test="${statusId==3}">
<div style="float: right; margin-right: 10px;" class="btn-group" id="buttonBox">
<button id="save" title="" type="button" onclick="printPage()" class="btn btn-gray"><i
class="fa fa-save"></i>打印
</button>
</div>
</c:if>
<div class="hg-form-row">
<x:selectC name="exceptionType" label="异常类型" labelCol="1" fieldCol="2" required="true" dictionary="exceptionType"/>
<x:inputC name="reportDate" label="呈报日期" labelCol="1" fieldCol="2" required="true" wrapper="date"/>
<x:inputC name="werksName" required="false" label="工厂" labelCol="1" wrapper="select" fieldCol="2"/>
<x:hidden name="werks"/>
<x:inputC name="exceptionTitle" label="异常标题" labelCol="1" fieldCol="2" required="true"/>
</div>
<div class="hg-form-row">
<x:selectC name="exceptionReasonType" label="异常原因分类" labelCol="1" fieldCol="2" required="true" dictionary="exceptionReasonType"/>
<x:inputC name="appealNo" label="客诉编号" labelCol="1" fieldCol="2" required="false"/>
<x:inputC name="customerName" label="客户名称" labelCol="1" fieldCol="2" required="true"/>
<x:inputC name="customerOrderNo" label="客户单号" labelCol="1" fieldCol="2" required="true"/>
<x:selectC name="urgency" label="紧急程度" labelCol="1" fieldCol="2" required="true" dictionary="urgency"/>
<x:inputC name="problemTimes" label="问题发生次数" labelCol="1" fieldCol="2" required="false"/>
<x:inputC name="brandName" label="品牌名称" labelCol="1" fieldCol="2" required="true"/>
<x:inputC name="exceptionDate" label="异常日期" labelCol="1" fieldCol="2" required="false" wrapper="date"/>
<x:checkbox name="needImproveReport" id="needImproveReport" cssStyle="margin-left:10px;" label="客户是否需要改善报告"/>
<x:checkbox name="needGuarantee" id="needGuarantee" cssStyle="margin-left:10px;" label="客户是否需要保证书"/>
</div>
</div>
<x:title title="单号信息" name="group" hideTable="#info" />
<div id="maingrid"></div>
<div class="hg-form-cols">
<div class="hg-form-row">
<x:textareaC name="exceptionState" required="false" label="异常陈诉" maxLength="120" labelCol="1" fieldCol="11" rows="3"/>
</div>
<div style="padding-top: 15px;">
<x:fileList bizCode="exceptionStateInfo" bizId="attbizId" id="exceptionStateInfoList" title="相关资料" />
</div>
<div class="hg-form-row">
<x:textareaC name="exceptionReason" required="false" label="异常原因" maxLength="120" labelCol="1" fieldCol="11" rows="3"/>
</div>
<div class="hg-form-row">
<x:textareaC name="dealMethod" required="false" label="改善措施" maxLength="120" labelCol="1" fieldCol="11" rows="3"/>
</div>
<div class="hg-form-row">
<x:inputC name="dutyDeptName" label="责任部门" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:hidden name="dutyDept"/>
<x:inputC name="checkOperatorName" label="责任人" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:hidden name="checkOperator"/>
</div>
<div class="hg-form-row">
<x:textareaC name="dealResult" required="false" label="处理结果" maxLength="120" labelCol="1" fieldCol="11" rows="3"/>
</div>
<div class="hg-form-row">
<x:inputC name="manager" label="单位主管" labelCol="1" fieldCol="2" required="false"/>
<x:inputC name="deputyManager" label="副理" labelCol="1" fieldCol="2" required="false"/>
<x:inputC name="generalManager" label="经理" labelCol="1" fieldCol="2" required="false"/>
</div>
<div class="hg-form-row">
<x:textareaC name="remark" required="false" label="备注" maxLength="120" labelCol="1" fieldCol="11" rows="3"/>
</div>
</div>
<x:title title="责任人信息" name="group" hideTable="#info" />
<div id="dutyPersonGrid"></div>
<div class="hg-form-row">
<x:inputC name="payMoney" label="赔付金额" labelCol="1" fieldCol="2" required="false" readonly="false" />
<x:inputC name="loseMoney" label="损失金额" labelCol="1" fieldCol="2" required="false" readonly="true" />
</div>
</form>
</div>
</body>
\ No newline at end of file
......@@ -2,7 +2,7 @@ var gridManager = null, refreshFlag = false, _roleId = null, purchaseSelectedLis
$(document).ready(function () {
initUI();
initGrid();
bindEvents();
}
);
......@@ -116,6 +116,19 @@ function initGrid() {
UICtrl.setSearchAreaToggle(gridManager);
}
function bindEvents() {
//产品类别
$('#productTypeName').searchbox({
type: "system", name: "dictionary",
getParam: function (item) {
return {fieldName: "MATKL"}
},
onChange: function (value, data) {
$('#productType').val(data.MATKL);
$('#productTypeName').val(data.WGBEZ);
}
});
}
/**
* 查看品质异常报告详情
......
......@@ -28,6 +28,8 @@
<x:selectC name="exceptionReasonType" label="异常原因分类" labelCol="1" dictionary="exceptionReasonType"/>
<x:selectC name="status" label="状态" labelCol="1" fieldCol="2" dictionary="bizBillStatus"/>
<x:selectC name="urgency" label="紧急程度" labelCol="1" fieldCol="2" dictionary="urgency"/>
<x:inputC name="productTypeName" label="产品类别" required="false" labelCol="1" fieldCol="2" wrapper="select"/>
<x:hidden name="productType"/>
</div>
<x:searchButtons/>
</form>
......
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@taglib uri="/WEB-INF/taglib.tld" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<x:base include="layout,dialog,grid,tree,combox,commonTree"/>
</head>
<body>
<form class="hg-form" method="post" action="" id="submitForm">
<div class="hg-form-cols">
<div class="hg-form-row">
<x:hidden name="id"/>
<x:inputC name="reasonType" label="序号(一级分类编码)" labelCol="3" fieldCol="2" required="true"/>
<x:inputC name="reasonTypeName" label="标准名称大类(一级分类)" labelCol="3" fieldCol="4" required="true" />
</div>
<div class="hg-form-row">
<x:inputC name="reasonTypeDetail" label="问题类型代码(二级分类 )" labelCol="3" fieldCol="2" required="true" />
<x:inputC name="reasonTypeDetailName" label="问题类型(二级分类 )" labelCol="3" fieldCol="4" required="true" />
</div>
</div>
</form>
</body>
</html>
......@@ -109,7 +109,6 @@ function bindEvent(){
}
},
onChange: function (value, data) {
debugger
$('#waers').val(data.waers);
$('#waersName').val(data.waersName);
$('#ltsnr').val(data.ltsnr);
......
......@@ -2,10 +2,14 @@ package com.huigou.topsun.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.cache.DictUtil;
import com.huigou.topsun.ep.epApplication.EpApplication;
import com.huigou.topsun.sap.exceptionReport.application.ExceptionReasonTypeDetailApplication;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReasonTypeDetail;
import com.huigou.topsun.sap.exceptionReport.repository.ExceptionReasonTypeDetailRepository;
import com.huigou.topsun.sap.sapApplication.application.*;
import com.huigou.topsun.sap.sapApplication.domain.query.SapDialogOrderQuery;
import com.huigou.topsun.sap.sapApplication.domain.query.SapDialogQuery;
......@@ -19,9 +23,11 @@ import com.huigou.uasp.bmp.common.easysearch.domain.model.QuerySchemeField;
import com.huigou.uasp.bmp.configuration.application.DictionaryApplication;
import com.huigou.uasp.bmp.opm.application.MemEasySearcher;
import com.huigou.uasp.bmp.opm.application.impl.MemEasySearcherImpl;
import com.huigou.util.ClassHelper;
import com.huigou.util.JSONUtil;
import com.huigou.util.SDO;
import com.huigou.util.StringUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
......@@ -56,6 +62,8 @@ public class ResourceSearchController {
private SuppliersDataApplication suppliersDataApplication;
@Autowired
private EpApplication epApplication;
@Autowired
private ExceptionReasonTypeDetailApplication exceptionReasonTypeDetailApplication;
@EasySearch(queryName = "knttp")
public Map<String, Object> knttpSelect(SDO sdo){
......@@ -354,24 +362,30 @@ public class ResourceSearchController {
PageRequest pageRequest = new PageRequest(intPage - 1, pageSize);
EasySearchParse easySearchParse = new EasySearchParse();
List<QuerySchemeField> fields =new ArrayList<>();
if ("2".equals(queryRequest.getReasonType())){ //生产异常
fields =
Arrays.asList(
new QuerySchemeField("订单号", "VBELN", "string", 150L),
// new QuerySchemeField("订单描述", "KTEXT", "string", 160L),
new QuerySchemeField("物料编码", "MATNR", "string", 160L),
new QuerySchemeField("物料描述", "MAKTX", "string", 160L),
new QuerySchemeField("数量", "PSMNG", "string", 100L),
new QuerySchemeField("单位", "MEINS", "string", 100L)
);
} else {
// if ("2".equals(queryRequest.getReasonType())){ //生产异常
// fields =
// Arrays.asList(
// new QuerySchemeField("订单号", "VBELN", "string", 150L),
// // new QuerySchemeField("订单描述", "KTEXT", "string", 160L),
// new QuerySchemeField("物料编码", "MATNR", "string", 160L),
// new QuerySchemeField("物料描述", "MAKTX", "string", 160L),
// new QuerySchemeField("数量", "PSMNG", "string", 100L),
// new QuerySchemeField("单位", "MEINS", "string", 100L)
// );
// } else {
// fields =
// Arrays.asList(
// new QuerySchemeField("订单号", "VBELN", "string", 130L),
// new QuerySchemeField("客户编号", "KUNNR", "string", 60L),
// new QuerySchemeField("客户名称", "NAME1", "string", 150L)
// );
// }
fields =
Arrays.asList(
new QuerySchemeField("订单号", "VBELN", "string", 130L),
new QuerySchemeField("客户编号", "KUNNR", "string", 60L),
new QuerySchemeField("客户名称", "NAME1", "string", 150L)
);
}
easySearchParse.setFields(fields);
easySearchParse.setWidth(500L);
MemEasySearcher<Map<String, String>> memEasySearcher = new MemEasySearcherImpl<>();
......@@ -768,4 +782,39 @@ public class ResourceSearchController {
return model;
}
/**
* 查询异常分类明细
* @param sdo
* @return
*/
@EasySearch(queryName = "selectExceptionReasonTypeDetail")
public Map<String, Object> selectExceptionReasonTypeDetail(SDO sdo) {
String param = sdo.getString("paramValue");
List<Map<String, String>> mapList = new ArrayList<>();
List<Map<String, Object>> maps = exceptionReasonTypeDetailApplication.getReasonTypeDetailListMap(param);
String result = JSONUtil.toString(maps);
ObjectMapper objectMapper = SAPUtils.objectMapper();
try {
mapList = objectMapper.readValue(result, new TypeReference<List<Map<String, String>>>() {});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
Integer intPage = sdo.getInteger("intPage", 1);
Integer pageSize = sdo.getInteger("pageSize",10);
PageRequest pageRequest = new PageRequest(intPage - 1, pageSize);
EasySearchParse easySearchParse = new EasySearchParse();
List<QuerySchemeField> fields =
Arrays.asList(
new QuerySchemeField("标准名称大类", "reasonTypeName", "string", 100L),
new QuerySchemeField("问题类型代码", "reasonTypeDetail", "string", 100L),
new QuerySchemeField("问题类型", "reasonTypeDetailName", "string", 200L),
new QuerySchemeField("序号(一级分类编码)", "reasonType", "hidden")
);
easySearchParse.setFields(fields);
easySearchParse.setWidth(500L);
MemEasySearcher<Map<String, String>> memEasySearcher = new MemEasySearcherImpl<>();
Map<String, Object> model = memEasySearcher.search(mapList, easySearchParse, pageRequest, null);
return model;
}
}
package com.huigou.topsun.sap.exceptionReport.application;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReasonTypeDetail;
import com.huigou.topsun.sap.exceptionReport.domain.query.ExceptionReasonTypeDetailQueryRequest;
import java.util.List;
import java.util.Map;
/**
* @author xin.lu
* @Description: TODO
* @date 2025/2/1115:25
*/
public interface ExceptionReasonTypeDetailApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/sap/exceptionReport/exceptionReasonTypeDetail.xml";
ExceptionReasonTypeDetail save(ExceptionReasonTypeDetail exceptionReasonTypeDetail);
void delete(String id);
Map<String, Object> getReasonTypeDetailMap(ExceptionReasonTypeDetailQueryRequest queryRequest);
void deleteByIds(List<String> ids);
ExceptionReasonTypeDetail load(String id);
List<Map<String, Object>> getReasonTypeDetailListMap(String param);
}
package com.huigou.topsun.sap.exceptionReport.application.impl;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.sap.exceptionReport.application.ExceptionReasonTypeDetailApplication;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReasonTypeDetail;
import com.huigou.topsun.sap.exceptionReport.domain.query.ExceptionReasonTypeDetailQueryRequest;
import com.huigou.topsun.sap.exceptionReport.repository.ExceptionReasonTypeDetailRepository;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import com.huigou.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @author xin.lu
* @Description: TODO
* @date 2025/2/1115:25
*/
@Service("exceptionReasonTypeDetailApplication")
public class ExceptionReasonTypeDetailApplicationImpl extends BaseApplication implements ExceptionReasonTypeDetailApplication {
@Autowired
private ExceptionReasonTypeDetailRepository exceptionReasonTypeDetailRepository;
@Override
public ExceptionReasonTypeDetail save(ExceptionReasonTypeDetail exceptionReasonTypeDetail) {
return exceptionReasonTypeDetailRepository.save(exceptionReasonTypeDetail);
}
@Override
public void delete(String id) {
exceptionReasonTypeDetailRepository.delete(id);
}
@Override
public Map<String, Object> getReasonTypeDetailMap(ExceptionReasonTypeDetailQueryRequest queryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "exceptionReasonTypeDetail");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest);
return this.sqlExecutorDao.executeSlicedQuery(queryModel);
}
@Override
public void deleteByIds(List<String> ids) {
ids.forEach(this::delete);
}
@Override
public ExceptionReasonTypeDetail load(String id) {
return exceptionReasonTypeDetailRepository.findOne(id);
}
@Override
public List<Map<String, Object>> getReasonTypeDetailListMap(String param) {
if (StringUtil.isNotBlank(param)){
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "exceptionReasonTypeDetailListByCondition");
String sql = queryDescriptor.getSql();
return this.sqlExecutorDao.queryToListMap(sql, param, param, param);
}else {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "exceptionReasonTypeDetailListNoCondition");
String sql = queryDescriptor.getSql();
return this.sqlExecutorDao.queryToListMap(sql);
}
}
}
package com.huigou.topsun.sap.exceptionReport.application.impl;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReasonTypeDetail;
import com.huigou.topsun.sap.exceptionReport.domain.TmpExceptionReasonTypeDetail;
import com.huigou.topsun.sap.exceptionReport.repository.ExceptionReasonTypeDetailRepository;
import com.huigou.topsun.sap.exceptionReport.repository.TmpExceptionReasonTypeDetailRepository;
import com.huigou.uasp.tool.dataimport.application.ExcelImportInterface;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
@Service("reasonTypeDetailExcelImport")
public class ExceptionReasonTypeDetailExcelImport implements ExcelImportInterface {
@Autowired
private TmpExceptionReasonTypeDetailRepository tmpExceptionReasonTypeDetailRepository;
@Autowired
private ExceptionReasonTypeDetailRepository exceptionReasonTypeDetailRepository;
@Override
public void executeImport(String batchNumer) {
List<TmpExceptionReasonTypeDetail> tmpExceptionReasonTypeDetails = tmpExceptionReasonTypeDetailRepository.findByBatchNumber(batchNumer);
if (!CollectionUtils.isEmpty(tmpExceptionReasonTypeDetails)){
for (TmpExceptionReasonTypeDetail tmpExceptionReasonTypeDetail : tmpExceptionReasonTypeDetails) {
ExceptionReasonTypeDetail exceptionReasonTypeDetail = new ExceptionReasonTypeDetail();
BeanUtils.copyProperties(tmpExceptionReasonTypeDetail,exceptionReasonTypeDetail);
exceptionReasonTypeDetailRepository.save(exceptionReasonTypeDetail);
}
}
System.out.println("=========================");
}
}
package com.huigou.topsun.sap.exceptionReport.controller;
import com.huigou.topsun.sap.exceptionReport.application.ExceptionReasonTypeDetailApplication;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReasonTypeDetail;
import com.huigou.topsun.sap.exceptionReport.domain.query.ExceptionReasonTypeDetailQueryRequest;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.util.List;
import java.util.Map;
/**
* @author xin.lu
* @Description: TODO
* @date 2025/2/1116:01
*/
@Controller
@ControllerMapping("/exceptionReasonTypeDetail")
public class ExceptionReasonTypeDetailController extends CommonController {
@Autowired
private ExceptionReasonTypeDetailApplication exceptionReasonTypeDetailApplication;
@Override
protected String getPagePath() {
return "/biz/topsun/sap/exceptionReport/";
}
/**
* 跳转到异常原因分类明细查询页面
* @return
*/
public String forwardExceptionReasonTypeDetailList(){
return forward("exceptionReasonTypeDetailList");
}
/**
* 条件查询异常原因分类明细
* @return
*/
public String slicedExceptionReasonTypeDetailList(){
SDO sdo = this.getSDO();
ExceptionReasonTypeDetailQueryRequest queryRequest = sdo.toQueryRequest(ExceptionReasonTypeDetailQueryRequest.class);
Map<String, Object> map = exceptionReasonTypeDetailApplication.getReasonTypeDetailMap(queryRequest);
return toResult(map);
}
public String showInsertExceptionReasonTypeDetail(){
return forward("insertExceptionReasonTypeDetail");
}
/**
* 保存异常原因分类明细
* @return
*/
public String savedExceptionReasonTypeDetail(){
SDO sdo = this.getSDO();
ExceptionReasonTypeDetail exceptionReasonTypeDetail = sdo.toObject( ExceptionReasonTypeDetail.class);
return toResult(exceptionReasonTypeDetailApplication.save(exceptionReasonTypeDetail));
}
public String showUpdateExceptionReasonTypeDetail(){
SDO sdo = this.getSDO();
String id = sdo.getString("id");
ExceptionReasonTypeDetail exceptionReasonTypeDetail = exceptionReasonTypeDetailApplication.load(id);
return forward("insertExceptionReasonTypeDetail",exceptionReasonTypeDetail);
}
/**
* 批量删除
* @return
*/
public String deleteExceptionReasonTypeDetail(){
SDO sdo = this.getSDO();
List<String> ids = sdo.getIds();
exceptionReasonTypeDetailApplication.deleteByIds(ids);
return success();
}
}
package com.huigou.topsun.sap.exceptionReport.domain;
import com.huigou.data.domain.model.AbstractEntity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @author xin.lu
* @Description: TODO
* @date 2025/2/1115:19
* 异常分类原因明细
*/
@Entity
@Table(name = "sap_exception_reason_type_detail")
@Data
public class ExceptionReasonTypeDetail extends AbstractEntity {
@Column(name = "reason_type")
private String reasonType;
@Column(name = "reason_type_name")
private String reasonTypeName;
@Column(name = "reason_type_detail")
private String reasonTypeDetail;
@Column(name = "reason_type_detail_name")
private String reasonTypeDetailName;
}
......@@ -214,6 +214,15 @@ public class ExceptionReport extends FlowBillAbstractEntity {
@Column(name = "produce_no")
private String produceNo;
@Column(name = "reason_type_name")
private String reasonTypeName;
@Column(name = "reason_type_detail")
private String reasonTypeDetail;
@Column(name = "reason_type_detail_name")
private String reasonTypeDetailName;
@Override
protected String getCodeRuleId() {
return "exceptionReport";
......
......@@ -117,4 +117,28 @@ public class ExceptionReportItem extends AbstractEntity {
*/
@Column(name = "exchange_rate")
private BigDecimal exchangeRate;
/**
* 运输费
*/
@Column(name = "freight")
private BigDecimal freight;
/**
* 返工费
*/
@Column(name = "rework")
private BigDecimal rework;
/**
* 停工待料费
*/
@Column(name = "stop_wait_material")
private BigDecimal stopWaitMaterial;
/**
* 开机费
*/
@Column(name = "startup_fee")
private BigDecimal startupFee;
}
package com.huigou.topsun.sap.exceptionReport.domain;
import com.huigou.topsun.common.AbstractPortalOrg;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @author xin.lu
* @Description: TODO
* @date 2025/2/1115:19
*/
@Entity
@Table(name = "tmp_exception_reason_type_detail")
@Data
public class TmpExceptionReasonTypeDetail extends AbstractPortalOrg {
/**
* 序号(一级分类编码)
*/
@Column(name = "reason_type")
private String reasonType;
/**
* 一级分类名称
*/
@Column(name = "reason_type_name")
private String reasonTypeName;
/**
* 二级分类编码
*/
@Column(name = "reason_type_detail")
private String reasonTypeDetail;
/**
* 二级分类名称
*/
@Column(name = "reason_type_detail_name")
private String reasonTypeDetailName;
}
package com.huigou.topsun.sap.exceptionReport.domain.query;
import com.huigou.data.domain.query.QueryAbstractRequest;
import lombok.Data;
/**
* @author xin.lu
* @Description: TODO
* @date 2025/2/1115:19
*/
@Data
public class ExceptionReasonTypeDetailQueryRequest extends QueryAbstractRequest {
private String no;
private String reasonType;
private String reasonTypeName;
private String reasonTypeDetail;
private String reasonTypeDetailName;
}
......@@ -24,5 +24,6 @@ public class ExceptionReportQueryRequest extends QueryAbstractRequest {
private String billCode;
private String exceptionReasonType;
private String urgency;
private String productType;
}
package com.huigou.topsun.sap.exceptionReport.repository;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReasonTypeDetail;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author xin.lu
* @Description: TODO
* @date 2025/2/1115:19
*/
public interface ExceptionReasonTypeDetailRepository extends JpaRepository<ExceptionReasonTypeDetail,String> {
}
package com.huigou.topsun.sap.exceptionReport.repository;
import com.huigou.topsun.sap.exceptionReport.domain.TmpExceptionReasonTypeDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @author xin.lu
* @Description: TODO
* @date 2025/2/1115:19
*/
public interface TmpExceptionReasonTypeDetailRepository extends JpaRepository<TmpExceptionReasonTypeDetail,String> {
List<TmpExceptionReasonTypeDetail> findByBatchNumber(String batchNumber);
}
......@@ -75,7 +75,9 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
werksList.add(signVo);
orderQueryVo.setWERKS(werksList);
}
if (StringUtils.isNotBlank(queryRequest.getKunnr())&&"3".equals(queryRequest.getReasonType())) { //客户编号
if (StringUtils.isNotBlank(queryRequest.getKunnr())
//&&"3".equals(queryRequest.getReasonType())
) { //客户编号
signVo = new SignVo();
signVo.setLow(queryRequest.getKunnr());
List<SignVo> kunnrList = new ArrayList<>();
......@@ -84,7 +86,19 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
}
if (StringUtils.isNotBlank(queryRequest.getParamValue())) { //过滤参数 按订单号查询
List <SignVo> vbelnList=new ArrayList<>();
if ("3".equals(queryRequest.getReasonType())) { //如果是客户异常
// if ("3".equals(queryRequest.getReasonType())) { //如果是客户异常
// //可能是多个客户单号
// String paramValue = queryRequest.getParamValue();
// String[] split = paramValue.split(",");
// List<String> paramValues = Arrays.asList(split);
// for (String value : paramValues) {
// signVo=new SignVo();
// signVo.setLow(value);
// signVo.setOption("EQ");
// vbelnList.add(signVo);
// }
// orderQueryVo.setBSTNK(vbelnList);
// }
//可能是多个客户单号
String paramValue = queryRequest.getParamValue();
String[] split = paramValue.split(",");
......@@ -96,17 +110,30 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
vbelnList.add(signVo);
}
orderQueryVo.setBSTNK(vbelnList);
} else { // 是生产异常
signVo=new SignVo();
signVo.setLow("*"+queryRequest.getParamValue()+"*");
signVo.setOption("CP");
vbelnList.add(signVo);
orderQueryVo.setAUFNR(vbelnList);
}
// else { // 是生产异常
// signVo=new SignVo();
// signVo.setLow("*"+queryRequest.getParamValue()+"*");
// signVo.setOption("CP");
// vbelnList.add(signVo);
// orderQueryVo.setAUFNR(vbelnList);
// }
}
//客户异常,根据生产单号查询
if (StringUtils.isNotBlank(queryRequest.getAufnr())){
if ("3".equals(queryRequest.getReasonType())){
// if ("3".equals(queryRequest.getReasonType())){
// List <SignVo> vbelnList=new ArrayList<>();
// String aufnr = queryRequest.getAufnr();
// String[] split = aufnr.split(",");
// List<String> aufnrs = Arrays.asList(split);
// for (String s : aufnrs) {
// signVo=new SignVo();
// String newStr = s.replaceFirst("^0*", "");
// signVo.setLow(newStr);
// signVo.setOption("EQ");
// vbelnList.add(signVo);
// }
// orderQueryVo.setAUFNR(vbelnList);
// }
List <SignVo> vbelnList=new ArrayList<>();
String aufnr = queryRequest.getAufnr();
String[] split = aufnr.split(",");
......@@ -120,8 +147,16 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
}
orderQueryVo.setAUFNR(vbelnList);
}
}
if ("3".equals(queryRequest.getReasonType())){ //如果是客户异常
// if ("3".equals(queryRequest.getReasonType())){ //如果是客户异常
// List <SignVo>auartList=new ArrayList<>();
// signVo=new SignVo();
// signVo.setLow("ZDO");
// auartList.add(signVo);
// SignVo signVo2=new SignVo();
// signVo2.setLow("ZEO");
// auartList.add(signVo2);
// orderQueryVo.setAUART(auartList);
// }
List <SignVo>auartList=new ArrayList<>();
signVo=new SignVo();
signVo.setLow("ZDO");
......@@ -130,11 +165,13 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
signVo2.setLow("ZEO");
auartList.add(signVo2);
orderQueryVo.setAUART(auartList);
} else{ //生产异常
InterfaceName="SEARCH/SCH_AUFNR";
}
// else{ //生产异常
// InterfaceName="SEARCH/SCH_AUFNR";
// }
if (StringUtils.isNotBlank(queryRequest.getVbeln())&&"3".equals(queryRequest.getReasonType())) { //客户单号
if (StringUtils.isNotBlank(queryRequest.getVbeln())
//&&"3".equals(queryRequest.getReasonType())
) { //客户单号
String vbeln = queryRequest.getVbeln();
String[] split = vbeln.split(",");
List<String> vbelns = Arrays.asList(split);
......@@ -151,60 +188,64 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
try {
String json ="";
List<Map<String, Object>> mapList=new ArrayList<>();
if ("3".equals(queryRequest.getReasonType())) { //如果是客户异常
// if ("3".equals(queryRequest.getReasonType())) { //如果是客户异常
// if (StringUtils.isNotBlank(queryRequest.getParamValue())||StringUtils.isNotBlank(queryRequest.getVbeln())) { //必须输入参数
// json = httpClient.execute(obj, InterfaceName);
// mapList = JSONUtil.toListMap(json);
// }
// }
if (StringUtils.isNotBlank(queryRequest.getParamValue())||StringUtils.isNotBlank(queryRequest.getVbeln())) { //必须输入参数
json = httpClient.execute(obj, InterfaceName);
mapList = JSONUtil.toListMap(json);
}
} else
{ //生产异常
Map<String,Object> param = new HashMap<>();
param.put("BUKRS",queryRequest.getWerks());
if (StringUtils.isNotBlank(queryRequest.getVbeln())){ //生产订单号
param.put("AUFNR",queryRequest.getVbeln());
}
if (StringUtils.isNotBlank(queryRequest.getParamValue())){
param.put("AUFNR",queryRequest.getParamValue());
}
List<Map<String,String>> mapList2 = new ArrayList<>();
json=httpClient.execute(param, "search/sch_aufnr");
Map<String, String> map = JSONObject.parseObject(json, Map.class);
SapResult sapResult = JSONObject.parseObject(cn.hutool.json.JSONUtil.toJsonStr(map.get("MSG")), SapResult.class);
if ("S".equals(sapResult.getTYPE())) {
ObjectMapper objectMapper = SAPUtils.objectMapper();
mapList2 = objectMapper.readValue(com.huigou.util.JSONUtil.toString(map.get("RDATA")), new TypeReference<List<Map<String, String>>>() {
});
if (StringUtils.isNotBlank(queryRequest.getVbeln())) {
for (Map mapItem : mapList2) {
Map newMap = new HashMap();
newMap.put("MATNR", mapItem.get("PLNBEZ")); //物料编号
newMap.put("MAKTX", mapItem.get("MAKTX")); //物料描述
newMap.put("PSMNG", mapItem.get("GAMNG")); //数量
newMap.put("MEINS", mapItem.get("GMEIN")); //单位
sapOrderVoList.add(newMap);
}
} else {
for (Map mapItem : mapList2) {
Map newMap = new HashMap();
newMap.put("VBELN", mapItem.get("AUFNR")); //订单号
newMap.put("KTEXT", mapItem.get("KTEXT")); //订单描述
newMap.put("MATNR", mapItem.get("PLNBEZ")); //物料编号
newMap.put("MAKTX", mapItem.get("MAKTX")!=null?mapItem.get("MAKTX"):""); //物料描述
newMap.put("PSMNG", mapItem.get("GAMNG")); //数量
newMap.put("MEINS", mapItem.get("GMEIN")); //单位
if (StringUtils.isNotBlank(queryRequest.getParamValue())
&&mapItem.get("AUFNR").toString().indexOf(queryRequest.getParamValue())>-1
) { //过滤参数
sapOrderVoList.add(newMap);
break;
}
//sapOrderVoList.add(newMap);
}
}
}
}
// else { //生产异常
// Map<String,Object> param = new HashMap<>();
// param.put("BUKRS",queryRequest.getWerks());
// if (StringUtils.isNotBlank(queryRequest.getVbeln())){ //生产订单号
// param.put("AUFNR",queryRequest.getVbeln());
// }
// if (StringUtils.isNotBlank(queryRequest.getParamValue())){
// param.put("AUFNR",queryRequest.getParamValue());
// }
// List<Map<String,String>> mapList2 = new ArrayList<>();
// json=httpClient.execute(param, "search/sch_aufnr");
// Map<String, String> map = JSONObject.parseObject(json, Map.class);
// SapResult sapResult = JSONObject.parseObject(cn.hutool.json.JSONUtil.toJsonStr(map.get("MSG")), SapResult.class);
// if ("S".equals(sapResult.getTYPE())) {
// ObjectMapper objectMapper = SAPUtils.objectMapper();
// mapList2 = objectMapper.readValue(com.huigou.util.JSONUtil.toString(map.get("RDATA")), new TypeReference<List<Map<String, String>>>() {
// });
// if (StringUtils.isNotBlank(queryRequest.getVbeln())) {
// for (Map mapItem : mapList2) {
// Map newMap = new HashMap();
// newMap.put("MATNR", mapItem.get("PLNBEZ")); //物料编号
// newMap.put("MAKTX", mapItem.get("MAKTX")); //物料描述
// newMap.put("PSMNG", mapItem.get("GAMNG")); //数量
// newMap.put("MEINS", mapItem.get("GMEIN")); //单位
//
// sapOrderVoList.add(newMap);
// }
// } else {
//
// for (Map mapItem : mapList2) {
// Map newMap = new HashMap();
// newMap.put("VBELN", mapItem.get("AUFNR")); //订单号
// newMap.put("KTEXT", mapItem.get("KTEXT")); //订单描述
// newMap.put("MATNR", mapItem.get("PLNBEZ")); //物料编号
// newMap.put("MAKTX", mapItem.get("MAKTX")!=null?mapItem.get("MAKTX"):""); //物料描述
// newMap.put("PSMNG", mapItem.get("GAMNG")); //数量
// newMap.put("MEINS", mapItem.get("GMEIN")); //单位
// if (StringUtils.isNotBlank(queryRequest.getParamValue())
// &&mapItem.get("AUFNR").toString().indexOf(queryRequest.getParamValue())>-1
// ) { //过滤参数
// sapOrderVoList.add(newMap);
// break;
// }
// //sapOrderVoList.add(newMap);
// }
// }
// }
// }
if (StringUtils.isNotBlank(queryRequest.getVbeln())) { //按生产订单号
for (Map map : mapList) {
List<Map<String, Object>> mapList2=(List<Map<String, Object>>)map.get("ITEM");
......@@ -281,7 +322,9 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
werksList.add(signVo);
orderQueryVo.setWERKS(werksList);
}
if (StringUtils.isNotBlank(queryRequest.getKunnr())&&"3".equals(queryRequest.getReasonType())) { //客户编号
if (StringUtils.isNotBlank(queryRequest.getKunnr())
//&&"3".equals(queryRequest.getReasonType())
) { //客户编号
signVo = new SignVo();
signVo.setLow(queryRequest.getKunnr());
List<SignVo> kunnrList = new ArrayList<>();
......@@ -306,12 +349,16 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
try {
String json ="";
List<Map<String, Object>> mapList=new ArrayList<>();
if ("3".equals(queryRequest.getReasonType())) { //如果是客户异常
// if ("3".equals(queryRequest.getReasonType())) { //如果是客户异常
// if (StringUtils.isNotBlank(queryRequest.getParamValue())) { //必须输入参数
// json = httpClient.execute(obj, InterfaceName);
// mapList = JSONUtil.toListMap(json);
// }
// }
if (StringUtils.isNotBlank(queryRequest.getParamValue())) { //必须输入参数
json = httpClient.execute(obj, InterfaceName);
mapList = JSONUtil.toListMap(json);
}
}
for (Map map : mapList) {
List<Map<String, Object>> mapList2=(List<Map<String, Object>>)map.get("ITEM");
for (Map mapItem:mapList2) {
......
<?xml version="1.0" encoding="UTF-8" ?>
<query-mappings>
<query name="exceptionReasonTypeDetail" label="异常原因分类" table="sap_exception_report">
<sql-query>
select t.* from sap_exception_reason_type_detail t
</sql-query>
<condition column="reason_type" name="reasonType" type="java.lang.String" symbol="=" alias="t"/>
<condition column="reason_type_name" name="reasonTypeName" type="java.lang.String" symbol="like" alias="t"/>
<condition column="reason_type_detail" name="reasonTypeDetail" type="java.lang.String" symbol="like" alias="t"/>
<condition column="reason_type_detail_name" name="reasonTypeDetailName" type="java.lang.String" symbol="like" alias="t"/>
</query>
<query name="exceptionReasonTypeDetailListByCondition" label="异常原因分类" table="sap_exception_report">
<sql-query>
select t.* from sap_exception_reason_type_detail t
where t.reason_type_name like concat('%',?,'%')
or t.reason_type_detail like concat('%',?,'%')
or t.reason_type_detail_name like concat('%',?,'%')
</sql-query>
</query>
<query name="exceptionReasonTypeDetailListNoCondition" label="异常原因分类" table="sap_exception_report">
<sql-query>
select t.* from sap_exception_reason_type_detail t
</sql-query>
</query>
</query-mappings>
\ No newline at end of file
......@@ -16,6 +16,7 @@
<condition column="report_date" name="endDate" type="java.util.Date" symbol="&lt;=" alias="t"/>
<condition column="exception_reason_type" name="exceptionReasonType" type="java.lang.String" symbol="=" alias="t"/>
<condition column="urgency" name="urgency" type="java.lang.String" symbol="=" alias="t"/>
<condition column="product_type" name="productType" type="java.lang.String" symbol="=" alias="t"/>
</query>
......
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