Commit a95068f8 authored by 1650842865's avatar 1650842865

采购信息记录修改,作废功能;放行条打印优化;异常报告金额合计

parent a99e33f4
......@@ -31,8 +31,8 @@
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">none</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.dialect">${system.hibernate.dialect}</prop>
<prop key="hibernate.enable_lazy_load_no_trans">true</prop>
</props>
......
......@@ -46,8 +46,8 @@
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">none</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.dialect">${system.hibernate.dialect}</prop>
<prop key="hibernate.enable_lazy_load_no_trans">true</prop>
</props>
......
......@@ -432,17 +432,26 @@ function initClientGrid() {
//异常金额 = 异常数量 * 单价
if (item.column.name == "exceptionNumber"|| item.column.name == "price" ){
if (Public.isNotBlank(item.record.exceptionNumber) && Public.isNotBlank(item.record.price)){
clientGridManager.updateRow(item.record, {money: MathUtil.mul(item.record.exceptionNumber,item.record.price) });
var money = MathUtil.mul(item.record.exceptionNumber,item.record.price);
clientGridManager.updateRow(item.record, {money: money,rmbMoney: MathUtil.mul(money,item.record.exchangeRate) });
//损失金额 = 行项目异常金额总和 + 赔付金额
countSum(clientGridManager.rows);
}
}
//运输费
// 返工费
// 停工待料费
if (item.column.name == "freight"|| item.column.name == "rework" || item.column.name == "stopWaitMaterial"){
//损失金额 = 行项目异常金额总和 + 赔付金额
countSum(clientGridManager.rows);
}
//换算金额 = 异常金额 * 汇率
if (item.column.name == "money"|| item.column.name == "exchangeRate" ){
if (Public.isNotBlank(item.record.money) && Public.isNotBlank(item.record.exchangeRate)){
clientGridManager.updateRow(item.record, {rmbMoney: MathUtil.mul(item.record.money,item.record.exchangeRate) });
countSum(clientGridManager.rows);
}
}
},
......@@ -825,16 +834,16 @@ function initPurchaseGrid() {
//autoApplyNextEditor:false,
toolbar: purchaseToolbarOptions,
onAfterEdit: function (item) {
if (item.column.name == 'rmbMoney' || item.column.name == 'freight'
if (item.column.name == 'money' || 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.record.rmbMoney)
.add(item.record.freight)
.add(item.record.rework)
.add(item.record.stopWaitMaterial)
.add(item.record.startupFee);
purchaseGridManager.updateRow(item.record, {totalMoney:money });
countSum(purchaseGridManager.rows);
}
},
onAfterShowData() {
......@@ -984,21 +993,22 @@ 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)) {
if (Public.isNotBlank(zrow[r].rmbMoney) && zrow[r].rmbMoney != 0) {
money = MathUtil.add(zrow[r].rmbMoney, money);
}else {
money = MathUtil.add(zrow[r].money, money);
}
money = money.add(zrow[r].freight).add(zrow[r].rework).add(zrow[r].stopWaitMaterial);
}else {
//供应商材料问题 运输费+返工费+停工待料费+损失金额+开机费+赔付金额=损失总金额
money = MathUtil.add(zrow[r].money, money);
money = money.add(zrow[r].freight).add(zrow[r].rework).add(zrow[r].stopWaitMaterial).add(zrow[r].startupFee);
}
}
money = MathUtil.add($('#payMoney').val(), money);
// for (var x=0;x<row.length;x++){
// money = MathUtil.add(row[x].dutyMoney,money);
// }
$('#loseMoney').val(money);
}
......
......@@ -443,6 +443,9 @@ function bindEvent() {
//选择了工厂、库存地点、仓库号,带出存储类型和上下架存储类型
bindEvent_lgtyp($('#werks').val(),data.LGORT,$('#lgnum').val());
$("#lgpro").val(data.LGORT);
$("#lgproName").val(data.LGOBE);
}
});
......
......@@ -1046,6 +1046,14 @@ function bindEvent() {
onChange: function (value, data) {
$('#lgort').val(data.LGORT);
$('#lgortName').val(data.LGOBE);
//物料主数据创建,修改,字段LGPRO优化一下
// 当LGPRO当为空时,默认=LGORT
// 不为空时,以实际填写为准
if (Public.isBlank($("#lgpro").val())){
$("#lgpro").val(data.LGORT);
$("#lgproName").val(data.LGOBE);
}
}
});
//仓库号
......
......@@ -175,7 +175,7 @@ function reloadGrid() {
}
function printPage() {
Public.openPostWindow(web_app.name + '/PDFViewer/PDFViewer.do',{id: $("#id").val(),applicationType:"sapPermit"});
Public.openPostWindow(web_app.name + '/sapPermit/printInfo.load',{id: $("#id").val()});
}
function getExtendedData(processAction) {
......
......@@ -27,7 +27,7 @@
<x:hidden name="isEmptyCar"/>
<div class="hg-form-cols">
<c:if test="${statusId==3}">
<c:if test="${statusId==3 || statusId==1}">
<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>打印
......
<%--采购申请--%>
<%@ 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,date,dateTime,combox,attachment,commonTree,comboDialog"/>
<x:script src="/biz/topsun/sap/purchaseInfoRecord/cancelPurchaseInfoRecord.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="id"/>
<x:hidden name="version"/>
<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="ids"/>
<x:hidden name="isReadOnly"/>
<x:hidden name="flag"/>
<div class="hg-form-cols">
<div class="hg-form-row">
</div>
</div>
<div id="maingrid"></div>
<div style="padding-top: 15px;">
<x:fileList bizCode="purchaseInfoRecord" bizId="id" id="fileList" title="相关资料" />
</div>
</form>
</div>
</body>
\ No newline at end of file
var gridManager = null;
var canEdit=true;
$(document).ready(function () {
initialize();
bindDetailEvent();
});
function initialize(){
UICtrl.layout("#layout", {leftWidth: 3});
}
function bindDetailEvent(){
}
<%@ 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"/>
<x:script src='/biz/topsun/sap/purchaseInfoRecord/cancelPurchaseInfoRecordDetail.js'/>
</head>
<body>
<form class="hg-form" method="post" action="" id="infoRecord">
<div class="hg-form-cols">
<div class="hg-form-row">
<x:hidden name="id"/>
<x:hidden name="rowId"/>
<x:hidden name="isReadOnly"/>
<x:hidden name="knumh"/>
<x:inputC name="infnr" label="信息记录编号" labelCol="1" fieldCol="2" required="false" readonly="true"/>
<x:hidden name="werks"/>
<x:inputC name="werksName" required="true" label="工厂" labelCol="1" readonly="true" fieldCol="2"/>
<x:hidden name="ekorg"/>
<x:inputC name="ekorgName" label="采购组织" labelCol="1" fieldCol="2" readonly="true" required="true"/>
<x:inputC name="lifnr" label="供应商" labelCol="1" fieldCol="2" required="true" readonly="true"/>
<x:inputC name="name1" label="供应商名称" labelCol="1" fieldCol="2" required="false" readonly="true"/>
<x:inputC name="idnlf" label="供应商物料" labelCol="1" fieldCol="2" readonly="true"/>
<x:inputC name="matnr" label="物料编码" labelCol="1" fieldCol="2" required="false" readonly="true"/>
<x:inputC name="maktx" label="物料描述" labelCol="1" fieldCol="2" readonly="true"/>
<x:selectC name="esokz" label="记录分类" labelCol="1" fieldCol="2" required="true" dictionary="esokz"
disabled="true"/>
<x:hidden name="ekgrp"/>
<x:inputC name="ekgrpName" label="采购组" labelCol="1" fieldCol="2" readonly="true" required="true"/>
<x:inputC name="netpr" label="净价" labelCol="1" fieldCol="2" required="true" mask="999999999.99"
readonly="true"/>
<x:inputC name="freight" label="运输费" labelCol="1" fieldCol="2" required="false" mask="99999999.99"
readonly="true"/>
<x:inputC name="kbetr6" label="包装费" labelCol="1" fieldCol="2" required="false" mask="99999999.99"
readonly="true"/>
<x:hidden name="matkl"/>
<x:inputC name="matklName" label="物料组" labelCol="1" fieldCol="2" readonly="true"/>
<x:inputC name="waersName" label="货币码" labelCol="1" fieldCol="2" required="true"
readonly="true"/>
<x:hidden name="waers"/>
<x:hidden name="ltsnr"/>
<x:hidden name="ltsbz"/>
<x:inputC name="peinh" label="价格单位" labelCol="1" fieldCol="2" required="true" mask="99999999.99"
readonly="true"/>
<x:inputC name="meinsName" label="基本计量单位" labelCol="1" fieldCol="2" required="false" readonly="true"/>
<x:hidden name="bprme"/>
<x:inputC name="bprmeName" label="订单价格单位(采购)" labelCol="2" fieldCol="2"
required="true" readonly="true"/>
<x:selectC name="mwskz" label="销售/购买税代码" labelCol="2" fieldCol="3" required="true"
dictionary="purchaseMwskz" disabled="true"/>
</div>
<div class="hg-form-row">
<x:hidden name="meins"/>
<x:inputC name="norbm" label="标准采购订单数量" labelCol="2" fieldCol="1" required="false"
mask="99999999.99" readonly="true"/>
<x:inputC name="umren" label="订单单位转换分母" labelCol="1" fieldCol="2" required="true" mask="99999999.99"
readonly="true"/>
<x:inputC name="umrez" label="订单单位转换分子" labelCol="1" fieldCol="2" required="true" mask="99999999.99"
readonly="true"/>
<x:inputC name="datab" required="true" label="生效日期起" wrapper="date" labelCol="1" fieldCol="2"/>
<x:inputC name="datbi" required="true" label="生效日期止" wrapper="date" labelCol="1" fieldCol="2"/>
<x:inputC name="verkf" label="销售员" labelCol="1" fieldCol="2" required="false" readonly="true"/>
<x:inputC name="telf1" label="电话" labelCol="1" fieldCol="2" required="false" readonly="true"/>
<x:inputC name="urzlaName" label="原产国" labelCol="1" fieldCol="2" required="false"
readonly="true"/>
<x:hidden name="urzla"/>
<x:inputC name="regioName" label="地区" labelCol="1" fieldCol="2" required="false"
readonly="true"/>
<x:hidden name="regio"/>
<x:selectC name="loekz" label="删除标志" labelCol="1" fieldCol="2" required="false" dictionary="loekz"/>
<x:inputC name="sortl" label="排序字段" labelCol="1" fieldCol="2" required="false" readonly="true"/>
<x:inputC name="minbm" label="最小采购订单数量" labelCol="2" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
<x:inputC name="aplfz" label="计划交货时间(天)" labelCol="2" fieldCol="1" required="true" mask="9999999"
readonly="true"/>
<x:selectC name="webre" label="基于收货的发票验证" labelCol="2" fieldCol="1" required="true"
dictionary="webre" disabled="true"/>
<x:selectC name="stfkz" label="等级类型" labelCol="1" fieldCol="5" required="true" dictionary="stfkz"
disabled="true"/>
</div>
<div class="hg-form-row">
<x:inputC name="kstbm" label="等级数量1" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
<x:inputC name="kstbm2" label="等级数量2" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
<x:inputC name="kstbm3" label="等级数量3" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
<x:inputC name="kstbm4" label="等级数量4" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
<x:inputC name="kstbm5" label="等级数量5" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
</div>
<div class="hg-form-row">
<x:inputC name="kbetr" label="等级金额1" labelCol="1" fieldCol="1" required="false" readonly="true"/>
<x:inputC name="kbetr2" label="等级金额2" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
<x:inputC name="kbetr3" label="等级金额3" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
<x:inputC name="kbetr4" label="等级金额4" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
<x:inputC name="kbetr5" label="等级金额5" labelCol="1" fieldCol="1" required="false" mask="9999999.99"
readonly="true"/>
</div>
<div class="hg-form-row">
<x:textareaC name="remark" rows="3" label="备注" labelCol="1" fieldCol="9"/>
</div>
</div>
</form>
</body>
</html>
......@@ -42,16 +42,16 @@ function initPurchaseListGrid() {
copyQualityInfoRecord();
}
},
// updateHandler:{
// id: 'updateHandler', text: "修改", img:'fa-edit', click: function(){
// updateHandlerInfoRecord();
// }
// }
// cancelHandler:{
// id: 'cancelHandler', text: "作废", img:'fa-trash-o', click: function(){
// cancelHandlerInfoRecord();
// }
// }
updateHandler:{
id: 'updateHandler', text: "修改", img:'fa-edit', click: function(){
updateHandlerInfoRecord();
}
},
cancelHandler:{
id: 'cancelHandler', text: "作废", img:'fa-trash-o', click: function(){
cancelHandlerInfoRecord();
}
}
});
purchaseInfoRecordGridManager = UICtrl.grid('#purchaseInfoRecordGrid', {
columns: [
......@@ -267,20 +267,25 @@ function updateHandlerInfoRecord(){
}
function cancelHandlerInfoRecord(){
var row = purchaseInfoRecordGridManager.getSelectedRow();
if (!row) {
var rows = purchaseInfoRecordGridManager.getSelectedRows();
if (rows.length == 0) {
Public.tip('请选择数据!');
return;
}
if (Public.isBlank(row.infnr)) {
Public.errorTip('只能作废有采购信息记录号的数据!');
return false;
var ids = [];
for (var i = 0; i < rows.length; i++){
var row=rows[i];
if (Public.isBlank(row.infnr)) {
Public.errorTip('只能作废有采购信息记录号的数据!');
return false;
}
ids.push(row.id)
}
UICtrl.confirm('您确定要作废该条采购信息记录吗,作废后无法恢复?', function () {
Public.ajax(web_app.name + '/sapPurchaseInfoRecord/cancelPurchaseRecord.ajax',
{id: row.id},
function () {
reloadPurchaseGrid();
});
});
UICtrl.addTabItem({
tabid: 'cancelHandlerInfoRecord' + row.id,
text: '作废采购信息记录',
url: web_app.name + '/sapPurchaseInfoRecord/showCancelHandlerInfoRecord.job?ids='+ ids.join(",")
})
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>物品携出放行条</title>
<#include "/print/commonStyleTemplate.ftl" />
<style type="text/css">
td {
font-size: 13px;
}
</style>
</head>
<body>
<div class="billTitle">物品领料单</div>
<span class="fs" style="font-family:SimSun;position: absolute;right: 60px;top: 1px">
<img class="barcode" src="${barCode}"></img>
</span>
<div class="blank_div"></div>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='70%'/>
<col width="30%"/>
</colgroup>
<tr>
<td class="left">单据编号:${billCode?default("")?html}</td>
<td class="left">录入日期:${fillinDate?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='70%'/>
<col width="30%"/>
</colgroup>
<tr>
<td class="left">公司名称:${company?default("")?html}</td>
<td class="left">携出人:${belongPerson?default("")?html}</td>
</tr>
</table>
<div> 物品明细</div>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='50%'/>
<col width='10%'/>
<col width='10%'/>
<col width='30%'/>
</colgroup>
<tr>
<td class="center">携出物品名称</td>
<td class="center">数量</td>
<td class="center">单位</td>
<td class="center">备注</td>
</tr>
<#if itemList?? && itemList?size gt 0>
<#list itemList as detail>
<tr>
<td class="center">${detail.belongings?default("")?html}</td>
<td class="center">${detail.quantity?default("")?html}</td>
<td class="center">${detail.unitName?default("")?html}</td>
<td class="center">${detail.remark?default("")?html}</td>
</tr>
</#list>
<#else>
<tr>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
</tr>
</#if>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='25%'/>
<col width="11%"/>
<col width="11%"/>
<col width="11%"/>
<col width="11%"/>
<col width="11%"/>
<col width="20%"/>
</colgroup>
<tr>
<td class="left">保安填写出厂时间:</td>
<td class="left"></td>
<td class="left"></td>
<td class="left"></td>
<td class="left"></td>
<td class="left"></td>
<td class="left">签字:</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='20%'/>
<col width="20%"/>
<col width="20%"/>
<col width="20%"/>
<col width="20%"/>
</colgroup>
<tr>
<td class="left">核准:${lastAuditPerson?default("")?html}</td>
<td class="left">审核:${preAuditPerson?default("")?html}</td>
<td class="left">供应商签收人:</td>
<td class="left">申请人:${personMemberName?default("")?html}</td>
<td class="left">制表人:${personMemberName?default("")?html}</td>
</tr>
</table>
</body>
</html>
......@@ -205,7 +205,7 @@ public class NonProducePickApplicationImpl extends FlowBroker implements NonProd
//实际退料数量大于等于退料数量标识完结Y,否则N
BigDecimal zerfmg = pickItem.getZerfmg();
BigDecimal backNum = pickItem.getBackNum();
if (zerfmg.compareTo(backNum) > 0){
if (zerfmg.compareTo(backNum) >= 0){
pickItem.setCheckedBox("Y");
}else {
pickItem.setCheckedBox("N");
......
......@@ -32,5 +32,5 @@ public interface SapPermitApplication {
void saveSapPermitVo(SapPermitVo sapPermitVo);
ByteArrayOutputStream printInfo(HttpServletResponse response, String id);
Map<String, Object> printInfo(String id);
}
......@@ -245,65 +245,46 @@ public class SapPermitApplicationImpl extends FlowBroker implements SapPermitApp
}
}
public String startProcessInstance(String processDefinitionKey,Map<String, Object> formData){
Map<String, Object> variables = new HashMap();
SDO localSdo = this.buildSDO(formData);
ThreadLocalUtil.putVariable(Constants.SDO, localSdo);
variables.put("startModel", ProcessStartModel.MANUAL.getId());
Operator operator = localSdo.getOperator();
variables.put("executorFullId", operator.getFullId());
variables.put("executorFullName", operator.getFullName());
ThreadLocalUtil.putOperator(operator);
ThreadLocalUtil.putVariable("client.ip", "127.0.0.1");
ProcessInstance processInstance = this.workflowApplication.startProcessInstanceByKey(processDefinitionKey, variables);
String businessKey = processInstance.getBusinessKey();
return businessKey;
}
private SDO buildSDO(Map<String, Object> formData) {
String createdById = (String) formData.get("applyPerson");
Operator operator = operatorApplication.createOperatorByPersonMemberId(createdById);
SDO localSdo = new SDO();
// 将业务数据传递给工作流
formData.forEach(localSdo::putProperty);
// 将业务流程信息传递给工作流
localSdo.putProperty("processAction", ProcessAction.SAVE);
localSdo.putProperty("procUnitId", "Apply");
localSdo.setOperator(operator);
return localSdo;
}
public ByteArrayOutputStream printInfo(HttpServletResponse response, String id) {
@Override
public Map<String, Object> printInfo(String id) {
SapPermit permit=this.sapPermitRepository.findOne(id);
Map<String, Object> data = ClassHelper.beanToMap(permit);
List <SapPermitItem> itemList=this.sapPermitItemRepository.findBySapPermitId(id);
if (itemList.size()<10){
int s=itemList.size();
for (int u=0;u<10-s;u++) {
SapPermitItem item = new SapPermitItem();
item.setBelongings("&nbsp;");
item.setBelongings("");
itemList.add(item);
}
}
String sql="select s.code,w.handler_name,w.handler_id,w.dept_name,w.full_id,w.HANDLED_DATE FROM WF_PROCUNITHANDLER w left join sa_oporg s on s.id=w.HANDLER_ID";
sql+=" where biz_id='"+id+"' order by w.HANDLED_DATE desc ";
sql+=" where biz_id='"+id+"' and w.result = 1 order by w.HANDLED_DATE desc ";
List<Map<String, Object>> mapList=sqlExecutorDao.queryToListMap(sql);
Map<String ,Object> data = new HashMap<>();
if (mapList.size()>0){
String lastAuditPerson=mapList.get(0).get("handlerName").toString();
data.put("lastAuditPerson",lastAuditPerson);
}
if (mapList.size()>1) {
String preLastAuditPerson = mapList.get(1).get("handlerName").toString();
data.put("preAuditPerson",preLastAuditPerson);
if (!CollectionUtils.isEmpty(mapList)){
if (mapList.size()==1) {
String preLastAuditPerson = mapList.get(0).get("handlerName").toString();
data.put("preAuditPerson",preLastAuditPerson);
data.put("lastAuditPerson",preLastAuditPerson);
}else {
String lastAuditPerson=mapList.get(0).get("handlerName").toString();
data.put("lastAuditPerson",lastAuditPerson);
String preLastAuditPerson = mapList.get(1).get("handlerName").toString();
data.put("preAuditPerson",preLastAuditPerson);
}
}
data.put("head",permit);
// if (mapList.size()>0){
// String lastAuditPerson=mapList.get(0).get("handlerName").toString();
// data.put("lastAuditPerson",lastAuditPerson);
// }
//
// if (mapList.size()>1) {
// String preLastAuditPerson = mapList.get(1).get("handlerName").toString();
// data.put("preAuditPerson",preLastAuditPerson);
// }
data.put("itemList",itemList);
//Document document = null;
ByteArrayOutputStream byteArrayOutputStream = null;
try {
File file = new File("bar-"+permit.getBillCode()+".png");
File file = new File("bar-"+permit.getBillCode()+".png");
if(!file.exists()) {
String IMG_TYPE_PNG = "image/png";
data.put("barCode", CommonUtils.genBarCode128(permit.getBillCode(), IMG_TYPE_PNG, file,128,10, HumanReadablePlacement.HRP_NONE));
......@@ -312,15 +293,38 @@ public class SapPermitApplicationImpl extends FlowBroker implements SapPermitApp
}
File fileb = new File("baoshen.png");
data.put("baoshen",fileb);
Template template = freemarkerConfigurer.getConfiguration().getTemplate("fxt.ftl");
byteArrayOutputStream = CommonUtils.createPDF(data,template);
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("PDF生成失败!");
}
return byteArrayOutputStream;
return data;
}
public String startProcessInstance(String processDefinitionKey,Map<String, Object> formData){
Map<String, Object> variables = new HashMap();
SDO localSdo = this.buildSDO(formData);
ThreadLocalUtil.putVariable(Constants.SDO, localSdo);
variables.put("startModel", ProcessStartModel.MANUAL.getId());
Operator operator = localSdo.getOperator();
variables.put("executorFullId", operator.getFullId());
variables.put("executorFullName", operator.getFullName());
ThreadLocalUtil.putOperator(operator);
ThreadLocalUtil.putVariable("client.ip", "127.0.0.1");
ProcessInstance processInstance = this.workflowApplication.startProcessInstanceByKey(processDefinitionKey, variables);
String businessKey = processInstance.getBusinessKey();
return businessKey;
}
private SDO buildSDO(Map<String, Object> formData) {
String createdById = (String) formData.get("applyPerson");
Operator operator = operatorApplication.createOperatorByPersonMemberId(createdById);
SDO localSdo = new SDO();
// 将业务数据传递给工作流
formData.forEach(localSdo::putProperty);
// 将业务流程信息传递给工作流
localSdo.putProperty("processAction", ProcessAction.SAVE);
localSdo.putProperty("procUnitId", "Apply");
localSdo.setOperator(operator);
return localSdo;
}
}
......@@ -3,6 +3,7 @@ package com.huigou.topsun.sap.permit.controller;
import com.huigou.context.Operator;
import com.huigou.context.OrgUnit;
import com.huigou.topsun.common.CommonUtils;
import com.huigou.topsun.sap.permit.application.SapPermitApplication;
import com.huigou.topsun.sap.permit.application.SapPermitItemApplication;
import com.huigou.topsun.sap.permit.domain.SapPermit;
......@@ -12,8 +13,10 @@ import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.client.CommonController;
import com.huigou.uasp.tool.dataimport.application.ExcelImportApplication;
import com.huigou.util.ClassHelper;
import com.huigou.util.CommonUtil;
import com.huigou.util.SDO;
import org.krysalis.barcode4j.HumanReadablePlacement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -22,6 +25,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -91,20 +95,10 @@ public class SapPermitController extends CommonController {
return success();
}
public String printPermitInfo() {
public String printInfo() {
SDO sdo = this.getSDO();
String id = sdo.getString("id");
System.out.println("id======="+id);
// HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
HttpServletResponse response = this .getResponse();
sapPermitApplication.printInfo(response,id);
//SapPermit permit=this.sapPermitApplication.getPermitById(id);
// List <SapPermitItem> itemList=sapPermitItemApplication.findBySapPermitId(id);
// String template="fxt.ftl";
// Map<String ,Object> data = new HashMap<>();
// data.put("head",permit);
// data.put("itemList",itemList);
return "";
// return outputPDF(template,data);
String id = sdo.getId();
Map<String, Object> data = this.sapPermitApplication.printInfo(id);
return outputAndProcUnitHandlerPDF("/permit.ftl", id, data);
}
}
......@@ -214,6 +214,11 @@ public class SapPurchaseInfoRecordApplicationImpl extends FlowBroker implements
if ("0".equals(sapPurchaseInfoRecordItemVo.getLoekz())){
sapPurchaseInfoRecordItemVo.setLoekz("");
}
if ("cancel".equals(sapPurchaseInfoRecord.getFlag())){
//如果是作废,设置报价失效标志为X
sapPurchaseInfoRecordItemVo.setZzf("X");
}
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("businessType", "采购信息记录维护");
resultMap.put("businessId", sapPurchaseInfoRecord.getId());
......
......@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -110,6 +111,25 @@ public class SapPurchaseInfoRecordController extends CommonController {
return forward("updatePurchaseInfoRecordDetail",item);
}
public String cancelSapPurchaseInfoRecordDetail() {
SDO sdo = this.getSDO();
String id = sdo.getId();
//String edit=sdo.getString("edit");
String rowId=sdo.getString("rowId");
SapPurchaseInfoRecordItem item = JSONUtil.toBean(sdo.getString("param"), SapPurchaseInfoRecordItem.class);
if (item!=null){
item.setRowId(rowId);
if (id.equals(rowId)){
item.setId("");
} else {
item.setId(id);
}
}
this.putAttribute("isReadOnly",sdo.getString("isReadOnly"));
// SapPurchaseInfoRecord sapPurchaseInfoRecord = sapPurchaseInfoRecordApplication.loadSapPurchaseInfoRecord(id);
return forward("cancelPurchaseInfoRecordDetail",item);
}
public String saveSapPurchaseInfoRecordDetail() {
SDO sdo = this.getSDO();
String id = sdo.getId();
......@@ -129,8 +149,12 @@ public class SapPurchaseInfoRecordController extends CommonController {
}
if ("new".equals(sapPurchaseInfoRecord.getFlag())){
return forward("purchaseInfoRecord",sapPurchaseInfoRecord);
}else {
}else if ("update".equals(sapPurchaseInfoRecord.getFlag())){
return forward("updatePurchaseInfoRecord",sapPurchaseInfoRecord);
}else if ("cancel".equals(sapPurchaseInfoRecord.getFlag())){
return forward("cancelPurchaseInfoRecord",sapPurchaseInfoRecord);
}else {
return forward("purchaseInfoRecord",sapPurchaseInfoRecord);
}
}
......@@ -170,6 +194,24 @@ public class SapPurchaseInfoRecordController extends CommonController {
return forward("updatePurchaseInfoRecord",sapPurchaseInfoRecord);
}
public String showCancelHandlerInfoRecord(){
SDO sdo = this.getSDO();
String ids = sdo.getString("ids");
this.putAttribute("processDefinitionKey", SapPurchaseInfoRecordApplication.PROCESS_DEFINITION_KEY);
// 新增的时候procUnitId一定要设置成Apply,不然jsp页面的所有表单元素是readonly状态
this.putAttribute("procUnitId", "Apply");
this.putAttribute("ids",ids);
SapPurchaseInfoRecord sapPurchaseInfoRecord = new SapPurchaseInfoRecord();
sapPurchaseInfoRecord.setId(null);
sapPurchaseInfoRecord.setStatusId(BizBillStatus.APPLYING.getId());
Operator operator = getOperator();
sapPurchaseInfoRecord.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName()));
String nextCode = codeGenerator.getNextCode("purchaseInfoRecord");
sapPurchaseInfoRecord.setBillCode(nextCode);
sapPurchaseInfoRecord.setFlag("cancel");
return forward("cancelPurchaseInfoRecord",sapPurchaseInfoRecord);
}
public String cancelPurchaseRecord(){
SDO sdo = this.getSDO();
String id = sdo.getId();
......
......@@ -273,4 +273,11 @@ public class SapPurchaseInfoRecordItemVo implements Serializable {
@JsonProperty("TXZ01")
private String txz01;
/**
* (报价失效标志),值范围:X(是),空(否)
*/
@JsonProperty("ZZF")
private String zzf;
}
......@@ -103,7 +103,7 @@
t.PRDAT,
t.BPUMN,
t.BPUMZ,
t.DATAB,
now() as DATAB,
t.DATBI,
t.KSTBM,
t.KONMS,
......
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