Commit 2d7aebf7 by 杨清松

Merge branch 'develop' of gitlab.beecode.cn:kunlun/xyst_dinas/xyst_dinas_backend into develop

parents f23c9971 02e085bd
......@@ -540,6 +540,38 @@
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>bcp.type.constraint.Numeric</m:type>
<m:properties>
<m:property>
<m:key>precision</m:key>
<m:value>12</m:value>
</m:property>
<m:property>
<m:key>scale</m:key>
<m:value>4</m:value>
</m:property>
</m:properties>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>dinas_amount</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>4b08ddf4-95fd-4b5d-96fd-9445b6983ebe</m:id>
<m:name>dinasAmount</m:name>
<m:title>合同总量</m:title>
<m:type>fixnum</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>bcp.type.constraint.StringLength</m:type>
<m:value>300</m:value>
</m:annotation>
......
......@@ -22,6 +22,7 @@ dependencies {
compile project(":xyst.dinas.biz")
compile project(":xyst.dinas.contract")
compile project(":xyst.dinas.price")
compile project(":xyst.dinas.project")
testCompile lib.amino_boot_web
......
......@@ -28,13 +28,16 @@ import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.xyst.dinas.biz.service.DinasOrganizationService;
import com.xyst.dinas.biz.service.DinasTypeService;
import com.xyst.dinas.biz.service.StationService;
import com.xyst.dinas.biz.warn.BaseBusinessWarn;
import com.xyst.dinas.biz.warn.dao.WarnSettingDao;
import com.xyst.dinas.biz.warn.service.WarningService;
import com.xyst.dinas.price.entity.StationDinasTypePriceDetail;
import com.xyst.dinas.price.service.PriceAdjustmentService;
import com.xyst.dinas.sales.constant.InventoryConstant;
import com.xyst.dinas.sales.dao.InventoryDao;
import com.xyst.dinas.sales.entity.InventoryLog;
import com.xyst.dinas.sales.entity.StationDinasTypeRelation;
import com.xyst.dinas.sales.processor.StockAmountWarnCalculate;
import com.xyst.dinas.sales.service.InventoryService;
public class InventoryServiceImpl implements InventoryService {
......@@ -64,6 +67,9 @@ public class InventoryServiceImpl implements InventoryService {
private WarnSettingDao warnSettingDao;
@Autowired
private WarningService warningService;
@Autowired
public BapContext bapContext;
@Override
......@@ -120,6 +126,9 @@ public class InventoryServiceImpl implements InventoryService {
kobj.set("amount", amount);
}
inventoryDao.update(kobj);
BaseBusinessWarn warn = warningService.createWarn("库存", UUID.fromString(stationId), dinasTypeName);
warn.setWarningCalculate(new StockAmountWarnCalculate(kobj.getDouble("amount")));
warn.warn();
if(isLog) {
try {
......
package com.xyst.dinas.sales.processor;
import com.xyst.dinas.biz.warn.IWarningCalculator;
import com.xyst.dinas.biz.warn.WarnSetting;
/**
* 库存砂石余量 预警计算器
*
* @author Jackpot
* @date 2021年4月22日
*/
public class StockAmountWarnCalculate implements IWarningCalculator{
//砂石库存量
private double stockAmount;
private String warnMessage;
public StockAmountWarnCalculate(double stockAmount) {
this.stockAmount = stockAmount;
}
@Override
public boolean isWarning(WarnSetting warnSetting) {
String min = warnSetting.getMin();
String dinasTypeName = warnSetting.getTarget();
if(min==null || min.trim().length()==0) return false;
if (stockAmount < Double.valueOf(min)) {
warnMessage = "["+dinasTypeName+"]"+"的当前库存量为"+stockAmount+",已不足"+min+"吨!";
return true;
}
return false;
}
@Override
public String warnMessage() {
return warnMessage;
}
@Override
public String getActualValue() {
return stockAmount+"";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata">
<specification>1.0</specification>
<id>691cf13f-181e-4728-babc-fc30d0258f19</id>
<name>com.xyst.dinas.sales.advanquery.ProjectAdvQuery</name>
<title>单位项目查询</title>
<description>单位项目查询</description>
<define>advanced.query.template</define>
<define-version>1.0</define-version>
<content>
<template>
<sql-type>SQL</sql-type>
<sql>
SELECT
organization.id AS id,
organization.name AS orgName,
company.name AS companyName,
project.projectName AS projectName,
project_type.title AS projectTypeTitle,
contract.deposit AS contractDeposit,
contract.advanceBalance AS contractAdvanceBalance,
contract.dinasAmount AS dinasAmount,
SUM(need_plan.needPlanTotalAmount) AS needPlanTotalAmount,
contract.saleDinasAmount AS saleDinasAmount,
contract.dinasAmount - contract.saleDinasAmount AS surplusAmount,
round(contract.saleDinasAmount / contract.dinasAmount * 100, 2) AS finishPercent
FROM
PurchaseSandCompany AS company
LEFT JOIN xystOrganization AS organization ON organization.id = company.regionalCompany
LEFT JOIN Contract AS contract ON contract.purchaseSandUnit = company.id
LEFT JOIN ProjectFiled AS project ON project.id = contract.project
LEFT JOIN ProjectType AS project_type ON project_type.id = project.projectType
LEFT JOIN NeedPlan AS need_plan ON need_plan.contract = contract.id
WHERE organization.id = :?regionalCompanyId and company.name like :?companyName and project.projectName like :?projectName and project_type.id = :?projectTypeId
</sql>
</template>
</content>
</metadata>
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata">
<specification>1.0</specification>
<id>29b894e6-a10e-41b1-afc4-9fa9927ee088</id>
<name>com.xyst.dinas.sales.advanquery.ProjectQueryView</name>
<title>单位项目查询</title>
<description>单位项目查询</description>
<define>advanced.query.view</define>
<define-version>1.0</define-version>
<content>
<view>
{
"name": "单位项目查询",
"title": "单位项目查询",
"description": "单位项目查询",
"actions": [],
"scenes" : {
"isShowScenes" : true
},
"fuzzySearch": [
],
"isShowTabCountZero": true,
"groups": [
{
"name": "all",
"title": "全部",
"content": {
"datasource": "com.xyst.dinas.sales.advanquery.ProjectAdvQuery"
}
}
],
"content": {
"isShowView": "table",
"datasource": "com.xyst.dinas.sales.advanquery.ProjectAdvQuery",
"arguments": {
"items": [
]
},
"actions": [
{
"param": [],
"enable": "ALL",
"name": "query_export",
"action": "query_export",
"title": "导出",
"type": ""
},
{
"name": "queryRefresh",
"title": "刷新",
"action": "queryRefresh",
"param": [],
"type": "",
"enable": "ALL"
}
],
"table": {
"selectType": "MULTI",
"serialNumber": "series",
"pageSize": 200,
"orders":[
],
"expand": false,
"columns": [
{
"type": "VALUE",
"title": "id",
"key": "id",
"columnType": {
"name" : "inner",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "区域公司",
"key": "orgName",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "购砂单位",
"key": "companyName",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "项目名称",
"key": "projectName",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "项目类型",
"key": "projectTypeTitle",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "保证金(元)",
"key": "contractDeposit",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "预付款余额(元)",
"key": "contractAdvanceBalance",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "合同量(吨)",
"key": "dinasAmount",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "需用总量(吨)",
"key": "needPlanTotalAmount",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "销售总量(吨)",
"key": "saleDinasAmount",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "剩余量(吨)",
"key": "surplusAmount",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "完成百分比(%)",
"key": "finishPercent",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type" : "ACTION",
"key" : "new_logo77b16046-4d20-4e43-b6bc-5e5e264014fe",
"title" : "操作列",
"width" : 150,
"actions" : [ {
"name" : "new_action",
"title" : "详情",
"action" : "openDetail",
"param" : {
"modelName" : "123"
},
"type" : ""
} ],
"nodeKey" : 13,
"align" : "center",
"isShow" : false
}
]
}
}
}
</view>
</content>
</metadata>
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