17 Commits

Author SHA1 Message Date
zhangzhiqiang
0112e723c7 fix:状态变更添加等待锁 2023-04-20 11:18:52 +08:00
zhangzhiqiang
9fd1a1e6dd fix:合同在途供应商列表 2023-04-13 21:21:03 +08:00
zhangzhiqiang
bd2d272b68 rev:注释 2023-04-13 16:40:00 +08:00
zhangzhiqiang
e7e55249af rev:合同在途修改为下拉框 2023-04-13 16:38:03 +08:00
zhangzhiqiang
1e30a0441f rev:拼盘精度问题;移库任务点位添加校验 2023-04-09 20:40:54 +08:00
zhangzhiqiang
e9cced47d4 fix:合同在途sql 2023-04-03 19:42:33 +08:00
zhangzhiqiang
db4ba29b36 fix:1.配粉槽分配重复2.合同在途供应商查询sql 2023-04-03 18:22:27 +08:00
zhangzhiqiang
239ff311cf rev:采购订单同步 2023-04-03 08:37:05 +08:00
zhangzhiqiang
9523165dc5 fix:sql 2023-03-21 11:13:06 +08:00
zhangzhiqiang
938c829f05 fex:合同在途查询条件修改 2023-03-20 10:52:41 +08:00
zhangzhiqiang
71af2168fd fix:合同在途sql修改 2023-03-20 10:50:10 +08:00
zhangzhiqiang
c36cb73bcf add:日常需求迭代 2023-03-17 19:08:22 +08:00
zhangzhiqiang
4b1ef310fc mdf:修改日志范围 2023-03-05 13:03:52 +08:00
zhangzhiqiang
a2f3e4f170 mdf:修改日志范围 2023-03-03 16:52:43 +08:00
zhangzhiqiang
e5fb957b33 add:生产环境配置 2023-03-01 15:23:54 +08:00
zhangzhiqiang
c30d6ea551 add:添加日志系统 2023-03-01 11:20:26 +08:00
zhangzhiqiang
bc04927b56 启动环境 2023-03-01 10:25:01 +08:00
28 changed files with 901 additions and 354 deletions

View File

@@ -120,6 +120,12 @@
<artifactId>okhttp</artifactId>
<version>4.8.1</version>
</dependency>
<!-- 解析客户端操作系统、浏览器信息 -->
<dependency>
<groupId>nl.basjes.parse.useragent</groupId>
<artifactId>yauaa</artifactId>
<version>5.23</version>
</dependency>
<!-- 导入Excel相关-->
<dependency>

View File

@@ -51,8 +51,9 @@ import java.util.Map;
@Slf4j
public class LogAspect {
@Pointcut("execution(* org.nl.wms.*.rest..*.*(..))")
//org.nl.ext.lk.rest org.nl.pda.pdm.rest
@Pointcut("execution(* org.nl.*.*..rest..*.*(..)) " +
"&& !execution(* org.nl.pda.pdm.rest.PfScreenController.*(..)) ")
public void logPointCut() {
}

View File

@@ -24,10 +24,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
@Service
@Slf4j
@@ -264,7 +261,6 @@ public class WmsToErpServiceImpl implements WmsToErpService {
item_import_date.setValue(DateUtil.now());
SpringContextHolder.getBean(ParamServiceImpl.class).update(item_import_date);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void getPurchaseInfo(Map map) {
@@ -286,20 +282,32 @@ public class WmsToErpServiceImpl implements WmsToErpService {
JSONArray ja = WQL.getWO("QERP").setDbname("dataSource1").addParamMap(whereMap).addParam("flag", "3").process().getResultJSONArray(0);
log.info("采购订单导入数据---------:" + ja.toString());
List<String> list = new ArrayList<>();
for (int i = 0; i < ja.size(); i++) {
JSONObject jo2 = ja.getJSONObject(i);
String VBILLCODE = jo2.getString("vbillcode");
String ITEM_ID = jo2.getString("item_id");
String CROWNO = jo2.getString("crowno");
String QTY = jo2.getString("qty");
String orderMd5 = VBILLCODE + ITEM_ID + CROWNO+QTY;
if (list.contains(orderMd5)){
log.warn("采购相同:{},md5:{}",JSON.toJSONString(jo2),orderMd5);
continue;
}
list.add(orderMd5);
//判断该采购订单是否存在,存在的话判断状态是否为生成,生成删除再添加,其他状态不操作
String PURCHASE_ID_B = jo2.getString("purchase_id_b");
JSONObject purchase_jo = purchase_proc_wql.query("PURCHASE_ID_B = '" + PURCHASE_ID_B + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(purchase_jo)) {
//判断是否生成入库单
//判断对于已经生成入库单/采购通知单的订单不做处理
JSONObject dtl = WQLObject.getWQLObject("st_ivt_iostorinvdtl").query("source_billdtl_id = '" + purchase_jo.getString("id") + "'").uniqueResult(0);
if (purchase_jo.getString("proc_status").equals("01") && ObjectUtil.isEmpty(dtl)) {
JSONObject dtlTab = WQLObject.getWQLObject("pcs_rc_receivedtl").query("source_billdtl_id = '" + purchase_jo.getString("id") + "'").uniqueResult(0);
if (purchase_jo.getString("proc_status").equals("01") && ObjectUtil.isEmpty(dtl) && ObjectUtil.isEmpty(dtlTab)) {
//删除
purchase_wql.delete("PURCHASE_ID_B = '" + PURCHASE_ID_B + "'");
purchase_proc_wql.delete("PURCHASE_ID_B = '" + PURCHASE_ID_B + "'");
log.info("order_back_up PURCHASE_ID_B:{},DATA:{}",PURCHASE_ID_B,JSON.toJSONString(purchase_jo));
} else {
//跳过
continue;
@@ -311,8 +319,7 @@ public class WmsToErpServiceImpl implements WmsToErpService {
String PK_DEPT = jo2.getString("pk_dept");
String VEND_ID = jo2.getString("vend_id");
String CEMPLOYEEID = jo2.getString("cemployeeid");
String VBILLCODE = jo2.getString("vbillcode");
String CROWNO = jo2.getString("crowno");
String CREATE_BY = jo2.getString("create_by");
String CREATE_DATE = jo2.getString("create_date");
if (StrUtil.isNotEmpty(CREATE_DATE)) {
@@ -323,9 +330,8 @@ public class WmsToErpServiceImpl implements WmsToErpService {
if (StrUtil.isNotEmpty(UPDATED_DATE)) {
UPDATED_DATE = DateUtil.parse(UPDATED_DATE, "yyyy-MM-dd HH:mm:ss").toString();
}
String ITEM_ID = jo2.getString("item_id");
String M_UNIT_ID = jo2.getString("m_unit_id");
String QTY = jo2.getString("qty");
String F_UNIT_ID = jo2.getString("f_unit_id");
String F_QTY = jo2.getString("f_qty");
String PRICE = jo2.getString("price");

View File

@@ -30,7 +30,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@@ -94,6 +96,8 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> needPFVehicle(Map jsonObject) {
WQLObject task_wql = WQLObject.getWQLObject("SCH_BASE_Task");
if (ObjectUtil.isEmpty(jsonObject)) {
throw new PdaRequestException("传入参数不能为空!");
}
@@ -137,16 +141,32 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
map.put("product_series_id", product_series_id);
map.put("workprocedure_id", workprocedure_id);
map.put("flag", "3");
JSONObject vehicle = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().uniqueResult(0);
JSONArray vehicles = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().getResultJSONArray(0);
//如果查询不到,就查物料属性为空的
if (ObjectUtil.isEmpty(vehicle)) {
if (vehicles.size() == 0) {
map.put("flag", "4");
vehicle = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(vehicle)) {
vehicles = WQL.getWO("QPDM_WORK_TASK").addParamMap(map).process().getResultJSONArray(0);
if (vehicles.size() == 0) {
throw new PdaRequestException("当前设备没有可用的配粉槽或配粉槽不在配粉暂存区!");
}
}
String sql = vehicles.stream().map(a -> ((JSONObject) a).getString("storagevehicle_code")).collect(Collectors.joining(","));
//过滤当前配粉槽是否存在未完成任务po.point_code,
List<String> runVehicles = task_wql.query("vehicle_code in ('" + sql + "') AND task_status < '99' AND is_delete = '0'").getResultJSONArray(0).stream().map(a -> ((JSONObject) a).getString("vehicle_code")).collect(Collectors.toList());
JSONObject vehicle = null;
for (Object o : vehicles) {
JSONObject item = (JSONObject)o;
String vehicle_code = item.getString("storagevehicle_code");
if (!runVehicles.contains(vehicle_code)){
vehicle = item;
break;
}
}
if (vehicle == null) {
log.error("配粉槽列表:{},存在未完成任务:{}",sql,runVehicles);
throw new PdaRequestException("当前设备没有可用的配粉槽存在未完成的任务!");
}
String storagevehicle_code = vehicle.getString("storagevehicle_code");
String point_code = vehicle.getString("point_code");
@@ -166,23 +186,26 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
String next_point_code = device_point.getString("point_code");
//判断起点或者终点是否锁定
JSONObject out_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
if (!out_point.getString("lock_type").equals("00")) {
throw new PdaRequestException("点位:" + point_code + "锁定!");
}
check_point_lock:{
JSONObject out_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
if (!out_point.getString("lock_type").equals("00")) {
throw new PdaRequestException("点位:" + point_code + "锁定!");
}
if (out_point.getString("is_used").equals("0")) {
throw new PdaRequestException("点位:" + point_code + "未启用!");
}
if (out_point.getString("is_used").equals("0")) {
throw new PdaRequestException("点位:" + point_code + "未启用!");
}
//判断起点或者终点是否锁定
JSONObject next_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + next_point_code + "'").uniqueResult(0);
if (!next_point.getString("lock_type").equals("00") || StrUtil.isNotEmpty(next_point.getString("vehicle_code"))) {
throw new PdaRequestException("点位:" + next_point_code + "锁定或点位上存在载具!");
}
//判断起点或者终点是否锁定
JSONObject next_point = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + next_point_code + "'").uniqueResult(0);
if (!next_point.getString("lock_type").equals("00") || StrUtil.isNotEmpty(next_point.getString("vehicle_code"))) {
throw new PdaRequestException("点位:" + next_point_code + "锁定或点位上存在载具!");
}
if (next_point.getString("is_used").equals("0")) {
throw new PdaRequestException("点位:" + next_point_code + "未启用!");
}
if (next_point.getString("is_used").equals("0")) {
throw new PdaRequestException("点位:" + next_point_code + "未启用!");
}
//生成搬运任务

View File

@@ -0,0 +1,46 @@
package org.nl.wms.common.util;
import lombok.SneakyThrows;
import org.nl.exception.BadRequestException;
import org.nl.utils.SpringContextHolder;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Function;
/*
* @author ZZQ
* @Date 2023/3/27 10:30
*/
public class RedissonUtils {
/**
*
* @param process 业务代码
* @param key
* @param seconds 尝试获取锁的等待时间,允许为空
*/
@SneakyThrows
public static void lock(Consumer process, String key, Integer seconds){
RedissonClient redissonClient = SpringContextHolder.getBean(RedissonClient.class);
RLock lock = redissonClient.getLock(key);
boolean isLock;
if (seconds == null){
isLock = lock.tryLock();
}else {
isLock = lock.tryLock(seconds, TimeUnit.SECONDS);
}
try {
if (isLock){
process.accept(null);
} else {
throw new BadRequestException("The current business is being processed key:"+key);
}
}finally {
if (isLock){
lock.unlock();
}
}
}
}

View File

@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author Liuxy
@@ -45,6 +46,8 @@ public class PcsIfPurchaseorderprocServiceImpl implements PcsIfPurchaseorderproc
@Autowired
private WmsToErpService wmsToErpService;
final ReentrantLock lock = new ReentrantLock();
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
HashMap<String, String> map = new HashMap<>(whereJson);
@@ -142,17 +145,28 @@ public class PcsIfPurchaseorderprocServiceImpl implements PcsIfPurchaseorderproc
@Override
@Transactional(rollbackFor = Exception.class)
public void importData(Map whereJson) {
ArrayList<String> arr = (ArrayList<String>) whereJson.get("createTime");
HashMap<String, String> map = new HashMap<>();
if (arr != null && arr.size() != 0) {
if (StrUtil.isNotEmpty(arr.get(0))) {
map.put("begin_time", arr.get(0));
boolean b = lock.tryLock();
try {
if (b){
ArrayList<String> arr = (ArrayList<String>) whereJson.get("createTime");
HashMap<String, String> map = new HashMap<>();
if (arr != null && arr.size() != 0) {
if (StrUtil.isNotEmpty(arr.get(0))) {
map.put("begin_time", arr.get(0));
}
if (StrUtil.isNotEmpty(arr.get(1))) {
map.put("end_time", arr.get(1));
}
}
wmsToErpService.getPurchaseInfo(map);
}else {
throw new BadRequestException("正在执行导入数据任务,请稍后再试");
}
if (StrUtil.isNotEmpty(arr.get(1))) {
map.put("end_time", arr.get(1));
}finally {
if(b){
lock.unlock();
}
}
wmsToErpService.getPurchaseInfo(map);
}
@Override

View File

@@ -169,7 +169,7 @@ public class ReceivemstServiceImpl implements ReceivemstService {
jsonMst.put("sysdeptid", deptId);
jsonMst.put("syscompanyid", deptId);
//明细
//明细:对应采购订单导入
JSONArray jsonArr = JSONArray.parseArray(JSON.toJSONString(whereJson.get("tableData")));
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);

View File

@@ -5237,7 +5237,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
for(int i=0;i<now_ivts.size();i++){
JSONObject now_ivt = now_ivts.getJSONObject(i);
//查询该物料的厂家质保书是否含有添加剂
//查询该物料的厂家质保书是否含有添加剂:纯粉是没有添加剂
JSONArray is_tjj = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",now_ivt.getString("material_id"))
.addParam("pcsn",now_ivt.getString("pcsn"))
@@ -5580,7 +5580,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(C_bu>0){
//Wp=Wp+W补
Cp = Cp + C_bu;
if(true){//cw_limit_down
if(true){//Cp > cw_limit_down
//计算非碳化钨需补重量
double finalR3p_jian = R3p_jian;
bj_bomdlts_map.forEach((key, bj_bomdlt)->{

View File

@@ -370,11 +370,12 @@ public class FactorywarrantymstServiceImpl implements FactorywarrantymstService
for (int i = 0; i < itemArr.size(); i++) {
JSONObject jsonObject = itemArr.getJSONObject(i);
String inspection_item_id = jsonObject.getString("inspection_item_id");
String inspection_item_code = jsonObject.getString("inspection_item_code");
JSONObject JsonValue =factDtlTab.query("inspection_item_id = '" + inspection_item_id + "' and inspection_id = '" + whereJson.getString("inspection_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(JsonValue)) {
num = num + 1;
}else {
throw new BadRequestException("产品检验方案标准表项点:"+inspection_item_id+"没有对应厂家质保书明细");
throw new BadRequestException("产品检验方案标准表项点:"+inspection_item_code+"没有对应厂家质保书明细");
}
}
if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");

View File

@@ -23,6 +23,7 @@ import org.nl.utils.SecurityUtils;
import org.nl.utils.SpringContextHolder;
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
import org.nl.wms.basedata.master.service.MaterialbaseService;
import org.nl.wms.common.util.RedissonUtils;
import org.nl.wms.pcs.Enum.ProcStatusEnum;
import org.nl.wms.pcs.Enum.ReceiveStatusEnum;
import org.nl.wms.ql.Enum.QlBillStatusEnum;
@@ -783,249 +784,259 @@ public class InspectionsheetmstServiceImpl implements InspectionsheetmstService
* 并按照原单据标识查到到货单并进行汇总实际数量 明细表原单据标识 = 到货单明细标识
*/
String inspection_id = jsonWhere.getString("inspection_id");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_InspectionSheetMst"); //质检单主表
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_InspectionSheetDtl"); //质检单明细表
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); //库存表
WQLObject flowTab = WQLObject.getWQLObject("ST_IVT_StructIvtFlow"); //仓位库存变动表
WQLObject redTab = WQLObject.getWQLObject("MD_PB_BucketRecord"); //桶记录表
WQLObject redFlowTab = WQLObject.getWQLObject("MD_PB_BucketChangeFlow"); //桶物料变动记录表
WQLObject reMstTab = WQLObject.getWQLObject("PCS_RC_ReceiveMst"); //到货通知单主表
WQLObject reDtlTab = WQLObject.getWQLObject("PCS_RC_ReceiveDtl"); //到货通知单明细表
WQLObject procTab = WQLObject.getWQLObject("PCS_IF_PurchaseOrderProc"); //采购订单接口处理表
WQLObject daTab = WQLObject.getWQLObject("ST_IVT_IOStorDaily"); //仓库物料日表
/*
* 更新到货通知单明细表
*/
JSONObject jsonDtl = dtlTab.query("inspection_id = '" + inspection_id + "'").uniqueResult(0);
JSONObject jsonMst = mstTab.query("inspection_id = '" + inspection_id + "'").uniqueResult(0);
String material_id = jsonDtl.getString("material_id");
//判断单据类型是否为原辅料单据 、并单据状态为完成
boolean is_yfl = materialBaseService.isAlongMaterType(MaterOptTypeEnum.YL_AND_FL.getCode(), material_id, null);
if (!is_yfl) {
throw new BadRequestException("此单据【" + jsonWhere.getString("inspection_code") + "】不为原辅料单据");
} else if (!StrUtil.equals(jsonWhere.getString("bill_status"), QlBillStatusEnum.FINISH.getCode())) {
throw new BadRequestException("只能对完成的单据进行状态变更");
}
JSONArray ivtDtlArr = WQL.getWO("QL_TEST_INSPECTIONSHEET002")
.addParam("flag", "2")
.addParam("material_id", jsonDtl.getString("material_id"))
.addParam("pcsn", jsonDtl.getString("pcsn")).process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(ivtDtlArr)) {
for (int j = 0; j < ivtDtlArr.size(); j++) {
JSONObject json = ivtDtlArr.getJSONObject(j);
JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + json.getString("source_billdtl_id") + "'").uniqueResult(0);
// 如果是合格或者是放行就存入 入库数
if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
jsonReDtl.put("instor_qty", 0);
// 如果是不合格就将入库数清0
} else {
jsonReDtl.put("instor_qty", json.getDoubleValue("real_qty"));
}
//判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中
if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) {
jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode());
} else {
jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode());
}
reDtlTab.update(jsonReDtl);
/*
* 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成
*/
JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0);
int flag = 0;
for (int i = 0; i < reDtlArr.size(); i++) {
JSONObject json1 = reDtlArr.getJSONObject(i);
if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
flag = flag + 1;
RedissonUtils.lock(
a->{
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0);
if (reDtlArr.size() == flag) {
jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode());
jsonReMst.put("confirm_optid", currentUserId);
jsonReMst.put("confirm_optname", nickName);
jsonReMst.put("confirm_time", now);
reMstTab.update(jsonReMst);
}
/*
* 如果到货单主表状态为确认,则需要更新采购订单接口处理表
*/
if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0);
// 到货数量 = 订单数量,为完成,否则为采购中
if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) {
jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode());
} else {
jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode());
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_InspectionSheetMst"); //质检单主表
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_InspectionSheetDtl"); //质检单明细表
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); //库存表
WQLObject flowTab = WQLObject.getWQLObject("ST_IVT_StructIvtFlow"); //仓位库存变动表
WQLObject redTab = WQLObject.getWQLObject("MD_PB_BucketRecord"); //桶记录表
WQLObject redFlowTab = WQLObject.getWQLObject("MD_PB_BucketChangeFlow"); //桶物料变动记录表
WQLObject reMstTab = WQLObject.getWQLObject("PCS_RC_ReceiveMst"); //到货通知单主表
WQLObject reDtlTab = WQLObject.getWQLObject("PCS_RC_ReceiveDtl"); //到货通知单明细表
WQLObject procTab = WQLObject.getWQLObject("PCS_IF_PurchaseOrderProc"); //采购订单接口处理表
WQLObject daTab = WQLObject.getWQLObject("ST_IVT_IOStorDaily"); //仓库物料日表
/*
* 更新到货通知单明细表
*/
JSONObject jsonDtl = dtlTab.query("inspection_id = '" + inspection_id + "'").uniqueResult(0);
JSONObject jsonMst = mstTab.query("inspection_id = '" + inspection_id + "'").uniqueResult(0);
String material_id = jsonDtl.getString("material_id");
//判断单据类型是否为原辅料单据 、并单据状态为完成
boolean is_yfl = materialBaseService.isAlongMaterType(MaterOptTypeEnum.YL_AND_FL.getCode(), material_id, null);
if (!is_yfl) {
throw new BadRequestException("此单据【" + jsonWhere.getString("inspection_code") + "】不为原辅料单据");
} else if (!StrUtil.equals(jsonWhere.getString("bill_status"), QlBillStatusEnum.FINISH.getCode())) {
throw new BadRequestException("只能对完成的单据进行状态变更");
}
procTab.update(jsonProc);
}
}
}
/*
* 更新仓位库存表
*/
JSONArray IvtArr = new JSONArray();
if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) {
IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "'").getResultJSONArray(0);
} else if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "'").getResultJSONArray(0);
}
if (ObjectUtil.isNotEmpty(IvtArr)) {
//判断当前库存是否有冻结数或者待入数
JSONObject ivt_now = WQL.getWO("QL_TEST_INSPECTIONSHEET002")
.addParam("flag", "5")
.addParam("material_id", jsonDtl.getString("material_id"))
.addParam("pcsn", jsonDtl.getString("pcsn"))
.process().uniqueResult(0);
if(ivt_now != null){
double frozen_qty = ivt_now.getDouble("frozen_qty");
double warehousing_qty = ivt_now.getDouble("warehousing_qty");
if(frozen_qty!=0 || warehousing_qty != 0){
throw new BadRequestException("此批次物料库存冻结数或待入数不为0,有未完成的单据,请稍后再试!");
}
}
/*
* 更新仓位库存表
*/
for (int i = 0; i < IvtArr.size(); i++) {
JSONObject jsonIvt = IvtArr.getJSONObject(i);
// 判断库存的可用数和库存数是否一致,不可以确认
if (jsonIvt.getDoubleValue("canuse_qty") != jsonIvt.getDoubleValue("ivt_qty")) {
throw new BadRequestException("此批次物料有未完成的单据");
}
JSONObject prarm = new JSONObject();
String change_type_scode = "";
prarm.put("struct_id", jsonIvt.getString("struct_id"));
prarm.put("material_id", jsonIvt.getString("material_id"));
prarm.put("quality_scode", jsonIvt.getString("quality_scode"));
prarm.put("pcsn", jsonIvt.getString("pcsn"));
prarm.put("ivt_level", jsonIvt.getString("ivt_level"));
prarm.put("is_active", jsonIvt.getString("is_active"));
prarm.put("change_qty", jsonIvt.getString("ivt_qty"));
prarm.put("bill_type_scode", jsonMst.getString("inspection_type"));
prarm.put("inv_id", jsonMst.getString("inspection_id"));
prarm.put("bill_code", jsonMst.getString("inspection_code"));
prarm.put("qty_unit_id", jsonIvt.getString("qty_unit_id"));
prarm.put("qty_unit_name", jsonIvt.getString("qty_unit_name"));
change_type_scode = "24";
storPublicService.IOStor(prarm, change_type_scode);
prarm.put("quality_scode", jsonDtl.getString("result"));
prarm.put("ivt_level", jsonDtl.getString("grade"));
change_type_scode = "23";
storPublicService.IOStor(prarm, change_type_scode);
}
/*
* 更新桶记录表
*/
JSONArray redArr = redTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "' and status = '03'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(redArr)) {
throw new BadRequestException("此物料【" + jsonMst.getString("material_code") + "】没有桶记录表");
}
for (int k = 0; k < redArr.size(); k++) {
JSONObject json = redArr.getJSONObject(k);
String quality_scode = json.getString("quality_scode"); // 原品质类型
String ivt_level = json.getString("ivt_level"); //原库存
String result_qty = json.getString("storage_qty"); // 原结存数量
json.put("quality_scode", jsonDtl.getString("result"));
json.put("ivt_level", jsonDtl.getString("grade"));
redTab.update(json);
if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
//不合格 插入桶物料变动表
JSONObject jsonRedFow = new JSONObject();
jsonRedFow.put("change_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRedFow.put("bucket_code", json.get("bucketunique"));
jsonRedFow.put("material_id", json.get("material_id"));
jsonRedFow.put("pcsn", json.getString("pcsn"));
jsonRedFow.put("ivt_level", ivt_level);
jsonRedFow.put("is_active", json.getString("is_active"));
jsonRedFow.put("quality_scode", quality_scode);
jsonRedFow.put("change_type_scode", "02");
jsonRedFow.put("change_time", now);
jsonRedFow.put("rec_person", currentUserId);
jsonRedFow.put("change_qty", result_qty);
jsonRedFow.put("qty_unit_id", json.getString("qty_unit_id"));
jsonRedFow.put("qty_unit_name", json.getString("qty_unit_name"));
redFlowTab.insert(jsonRedFow);
} else if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) {
// 合格 插入桶物料变动表
JSONObject jsonRedFow = new JSONObject();
jsonRedFow.put("change_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRedFow.put("bucket_code", json.get("bucketunique"));
jsonRedFow.put("material_id", json.get("material_id"));
jsonRedFow.put("pcsn", json.getString("pcsn"));
jsonRedFow.put("ivt_level", jsonDtl.getString("grade"));
jsonRedFow.put("is_active", json.getString("is_active"));
jsonRedFow.put("quality_scode", jsonDtl.getString("result"));
jsonRedFow.put("change_type_scode", "01");
jsonRedFow.put("change_time", now);
jsonRedFow.put("rec_person", currentUserId);
jsonRedFow.put("change_qty", result_qty);
jsonRedFow.put("result_qty", result_qty);
jsonRedFow.put("qty_unit_id", json.getString("qty_unit_id"));
jsonRedFow.put("qty_unit_name", json.getString("qty_unit_name"));
redFlowTab.insert(jsonRedFow);
}
}
}
//判断质检单是否合格;不合格就走退货流程
if (StrUtil.equals(jsonDtl.getString("result"), "02") && ObjectUtil.isNotEmpty(ivtDtlArr)) {
/*
* 插入退货单
* 主表参数bill_code=, stor_id=1473161852946092032, stor_code=01,
* stor_name=原材料库, bill_status=10, total_qty=2, detail_count=1,
* bill_type=010201, remark=, biz_date=2022-01-08, create_mode=
*
* 明细参数bill_status=10,
* pcsn=, quality_scode=02, ivt_level=01,
* is_active=1, plan_qty=2, qty_unit_name=千克\公斤, qty_unit_id=1, remark=, edit=true
*/
// 根据物料、批次找出所有库存
JSONArray ivtArrAll = WQL.getWO("QL_TEST_INSPECTIONSHEET002").addParam("flag", "4").addParam("material_id", jsonDtl.getString("material_id")).addParam("pcsn", jsonDtl.getString("pcsn")).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(ivtArrAll)) {
throw new BadRequestException("此批次【" + jsonDtl.getString("pcsn") + "】没有物料为【" + jsonMst.getString("material_code") + "】的库存");
}
double total_qty = 0;
for (int i = 0; i < ivtArrAll.size(); i++) {
JSONObject json = ivtArrAll.getJSONObject(i);
json.put("bill_status", "10");
json.put("pcsn", jsonDtl.getString("pcsn"));
json.put("quality_scode", jsonDtl.getString("result"));
json.put("ivt_level", jsonDtl.getString("grade"));
json.put("is_active", jsonDtl.getString("is_active"));
json.put("plan_qty", json.getString("ivt_qty"));
json.put("qty_unit_name", json.getString("qty_unit_name"));
json.put("qty_unit_id", json.getString("qty_unit_id"));
json.put("remark", "");
json.put("edit", true);
total_qty += json.getDoubleValue("ivt_qty");
}
JSONObject param = new JSONObject();
param.put("stor_id", "1473161852946092032");
param.put("stor_code", "01");
param.put("stor_name", "原材料库");
param.put("bill_status", "10");
param.put("total_qty", total_qty);
param.put("detail_count", ivtArrAll.size());
if (StrUtil.equals(jsonMst.getString("inspection_type"), "10")) param.put("bill_type", "010201");
if (StrUtil.equals(jsonMst.getString("inspection_type"), "20")) param.put("bill_type", "010202");
param.put("remark", "");
param.put("biz_date", DateUtil.today());
param.put("create_mode", "01");
param.put("tableData", ivtArrAll);
checkOutBillService.insertDtlByJson(param);
}
JSONArray ivtDtlArr = WQL.getWO("QL_TEST_INSPECTIONSHEET002")
.addParam("flag", "2")
.addParam("material_id", jsonDtl.getString("material_id"))
.addParam("pcsn", jsonDtl.getString("pcsn")).process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(ivtDtlArr)) {
for (int j = 0; j < ivtDtlArr.size(); j++) {
JSONObject json = ivtDtlArr.getJSONObject(j);
JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + json.getString("source_billdtl_id") + "'").uniqueResult(0);
// 如果是合格或者是放行就存入 入库数
if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
jsonReDtl.put("instor_qty", 0);
// 如果是不合格就将入库数清0
} else {
jsonReDtl.put("instor_qty", json.getDoubleValue("real_qty"));
}
//判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中
if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) {
jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode());
} else {
jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode());
}
reDtlTab.update(jsonReDtl);
/*
* 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成
*/
JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0);
int flag = 0;
for (int i = 0; i < reDtlArr.size(); i++) {
JSONObject json1 = reDtlArr.getJSONObject(i);
if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
flag = flag + 1;
}
}
JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0);
if (reDtlArr.size() == flag) {
jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode());
jsonReMst.put("confirm_optid", currentUserId);
jsonReMst.put("confirm_optname", nickName);
jsonReMst.put("confirm_time", now);
reMstTab.update(jsonReMst);
}
/*
* 如果到货单主表状态为确认,则需要更新采购订单接口处理表
*/
if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0);
// 到货数量 = 订单数量,为完成,否则为采购中
if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) {
jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode());
} else {
jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode());
}
procTab.update(jsonProc);
}
}
}
/*
* 更新仓位库存表
*/
JSONArray IvtArr = new JSONArray();
if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) {
IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "'").getResultJSONArray(0);
} else if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "'").getResultJSONArray(0);
}
if (ObjectUtil.isNotEmpty(IvtArr)) {
//判断当前库存是否有冻结数或者待入数
JSONObject ivt_now = WQL.getWO("QL_TEST_INSPECTIONSHEET002")
.addParam("flag", "5")
.addParam("material_id", jsonDtl.getString("material_id"))
.addParam("pcsn", jsonDtl.getString("pcsn"))
.process().uniqueResult(0);
if (ivt_now != null) {
double frozen_qty = ivt_now.getDouble("frozen_qty");
double warehousing_qty = ivt_now.getDouble("warehousing_qty");
if (frozen_qty != 0 || warehousing_qty != 0) {
throw new BadRequestException("此批次物料库存冻结数或待入数不为0,有未完成的单据,请稍后再试!");
}
}
/*
* 更新仓位库存表
*/
for (int i = 0; i < IvtArr.size(); i++) {
JSONObject jsonIvt = IvtArr.getJSONObject(i);
// 判断库存的可用数和库存数是否一致,不可以确认
if (jsonIvt.getDoubleValue("canuse_qty") != jsonIvt.getDoubleValue("ivt_qty")) {
throw new BadRequestException("此批次物料有未完成的单据");
}
JSONObject prarm = new JSONObject();
String change_type_scode = "";
prarm.put("struct_id", jsonIvt.getString("struct_id"));
prarm.put("material_id", jsonIvt.getString("material_id"));
prarm.put("quality_scode", jsonIvt.getString("quality_scode"));
prarm.put("pcsn", jsonIvt.getString("pcsn"));
prarm.put("ivt_level", jsonIvt.getString("ivt_level"));
prarm.put("is_active", jsonIvt.getString("is_active"));
prarm.put("change_qty", jsonIvt.getString("ivt_qty"));
prarm.put("bill_type_scode", jsonMst.getString("inspection_type"));
prarm.put("inv_id", jsonMst.getString("inspection_id"));
prarm.put("bill_code", jsonMst.getString("inspection_code"));
prarm.put("qty_unit_id", jsonIvt.getString("qty_unit_id"));
prarm.put("qty_unit_name", jsonIvt.getString("qty_unit_name"));
change_type_scode = "24";
storPublicService.IOStor(prarm, change_type_scode);
prarm.put("quality_scode", jsonDtl.getString("result"));
prarm.put("ivt_level", jsonDtl.getString("grade"));
change_type_scode = "23";
storPublicService.IOStor(prarm, change_type_scode);
}
/*
* 更新桶记录表
*/
JSONArray redArr = redTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "' and status = '03'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(redArr)) {
throw new BadRequestException("此物料【" + jsonMst.getString("material_code") + "】没有桶记录表");
}
for (int k = 0; k < redArr.size(); k++) {
JSONObject json = redArr.getJSONObject(k);
String quality_scode = json.getString("quality_scode"); // 原品质类型
String ivt_level = json.getString("ivt_level"); //原库存
String result_qty = json.getString("storage_qty"); // 原结存数量
json.put("quality_scode", jsonDtl.getString("result"));
json.put("ivt_level", jsonDtl.getString("grade"));
redTab.update(json);
if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
//不合格 插入桶物料变动表
JSONObject jsonRedFow = new JSONObject();
jsonRedFow.put("change_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRedFow.put("bucket_code", json.get("bucketunique"));
jsonRedFow.put("material_id", json.get("material_id"));
jsonRedFow.put("pcsn", json.getString("pcsn"));
jsonRedFow.put("ivt_level", ivt_level);
jsonRedFow.put("is_active", json.getString("is_active"));
jsonRedFow.put("quality_scode", quality_scode);
jsonRedFow.put("change_type_scode", "02");
jsonRedFow.put("change_time", now);
jsonRedFow.put("rec_person", currentUserId);
jsonRedFow.put("change_qty", result_qty);
jsonRedFow.put("qty_unit_id", json.getString("qty_unit_id"));
jsonRedFow.put("qty_unit_name", json.getString("qty_unit_name"));
redFlowTab.insert(jsonRedFow);
} else if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) {
// 合格 插入桶物料变动表
JSONObject jsonRedFow = new JSONObject();
jsonRedFow.put("change_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRedFow.put("bucket_code", json.get("bucketunique"));
jsonRedFow.put("material_id", json.get("material_id"));
jsonRedFow.put("pcsn", json.getString("pcsn"));
jsonRedFow.put("ivt_level", jsonDtl.getString("grade"));
jsonRedFow.put("is_active", json.getString("is_active"));
jsonRedFow.put("quality_scode", jsonDtl.getString("result"));
jsonRedFow.put("change_type_scode", "01");
jsonRedFow.put("change_time", now);
jsonRedFow.put("rec_person", currentUserId);
jsonRedFow.put("change_qty", result_qty);
jsonRedFow.put("result_qty", result_qty);
jsonRedFow.put("qty_unit_id", json.getString("qty_unit_id"));
jsonRedFow.put("qty_unit_name", json.getString("qty_unit_name"));
redFlowTab.insert(jsonRedFow);
}
}
}
//判断质检单是否合格;不合格就走退货流程
if (StrUtil.equals(jsonDtl.getString("result"), "02") && ObjectUtil.isNotEmpty(ivtDtlArr)) {
/*
* 插入退货单
* 主表参数bill_code=, stor_id=1473161852946092032, stor_code=01,
* stor_name=原材料库, bill_status=10, total_qty=2, detail_count=1,
* bill_type=010201, remark=, biz_date=2022-01-08, create_mode=
*
* 明细参数bill_status=10,
* pcsn=, quality_scode=02, ivt_level=01,
* is_active=1, plan_qty=2, qty_unit_name=千克\公斤, qty_unit_id=1, remark=, edit=true
*/
// 根据物料、批次找出所有库存
JSONArray ivtArrAll = WQL.getWO("QL_TEST_INSPECTIONSHEET002").addParam("flag", "4").addParam("material_id", jsonDtl.getString("material_id")).addParam("pcsn", jsonDtl.getString("pcsn")).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(ivtArrAll)) {
throw new BadRequestException("此批次【" + jsonDtl.getString("pcsn") + "】没有物料为【" + jsonMst.getString("material_code") + "】的库存");
}
double total_qty = 0;
for (int i = 0; i < ivtArrAll.size(); i++) {
JSONObject json = ivtArrAll.getJSONObject(i);
json.put("bill_status", "10");
json.put("pcsn", jsonDtl.getString("pcsn"));
json.put("quality_scode", jsonDtl.getString("result"));
json.put("ivt_level", jsonDtl.getString("grade"));
json.put("is_active", jsonDtl.getString("is_active"));
json.put("plan_qty", json.getString("ivt_qty"));
json.put("qty_unit_name", json.getString("qty_unit_name"));
json.put("qty_unit_id", json.getString("qty_unit_id"));
json.put("remark", "");
json.put("edit", true);
total_qty += json.getDoubleValue("ivt_qty");
}
JSONObject param = new JSONObject();
param.put("stor_id", "1473161852946092032");
param.put("stor_code", "01");
param.put("stor_name", "原材料库");
param.put("bill_status", "10");
param.put("total_qty", total_qty);
param.put("detail_count", ivtArrAll.size());
if (StrUtil.equals(jsonMst.getString("inspection_type"), "10")) param.put("bill_type", "010201");
if (StrUtil.equals(jsonMst.getString("inspection_type"), "20")) param.put("bill_type", "010202");
param.put("remark", "");
param.put("biz_date", DateUtil.today());
param.put("create_mode", "01");
param.put("tableData", ivtArrAll);
checkOutBillService.insertDtlByJson(param);
}
},inspection_id,2
);
}
@Override

View File

@@ -15,7 +15,9 @@
#################################################
输入.flag TYPEAS s_string
输入.ext_id TYPEAS s_string
输入.material_id TYPEAS s_string
输入.material_id TYPEAS s_string
输入.source_name TYPEAS s_string
输入.hide TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.mater_ids TYPEAS f_string
@@ -150,7 +152,8 @@
PURCHASE.ITEM_NAME as material_name,
PURCHASE.NAME,
PURCHASE.NORIGTAXPRICE,
PURCHASE.NORIGTAXMNY
PURCHASE.NORIGTAXMNY,
sum(PURCHASE.QTY_ZT)*PURCHASE.NORIGTAXPRICE as notmny
FROM
PURCHASE_CONTRACT_VIEW PURCHASE
where
@@ -162,11 +165,30 @@
OPTION 输入.mater_ids <> ""
PURCHASE.ITEM_ID in 输入.mater_ids
ENDOPTION
OPTION 输入.source_name <> ""
PURCHASE.NAME = 输入.source_name
ENDOPTION
OPTION 输入.hide <> ""
1=1 HAVING sum( PURCHASE.QTY_ZT ) > 0
ENDOPTION
GROUP BY PURCHASE.ITEM_ID,PURCHASE.VBILLCODE, PURCHASE.ITEM_CODE, PURCHASE.ITEM_NAME,PURCHASE.NAME,PURCHASE.NORIGTAXPRICE,PURCHASE.NORIGTAXMNY
ORDER BY PURCHASE.ITEM_CODE, PURCHASE.VBILLCODE
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "7"
QUERY
SELECT
DISTINCT PURCHASE.NAME
FROM
PURCHASE_CONTRACT_VIEW PURCHASE
where
PURCHASE.STATUSFLAG = '1'
AND PURCHASE.DEL_FLAG = '0'
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -241,7 +241,19 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
jo.put("turnin_struct_code", row.getString("turnin_struct_code"));
jo.put("turnin_struct_name", row.getString("turnin_struct_name"));
//查询移入点位
JSONObject point = wo_Point.query("source_id='" + turnin_struct_id + "'").uniqueResult(0);
JSONArray point_jo = wo_Point.query("source_id='" + turnin_struct_id + "'").getResultJSONArray(0);
if (point_jo.size() == 0) {
throw new BadRequestException(row.getString("turnin_struct_code") + "仓位数据异常,找不到对应点位!");
}
JSONObject point=null;
for (Object o : point_jo) {
point = (JSONObject) o;
if (!point.getString("lock_type").equals("00")){
continue;
}
String pointCode = point.getString("point_code");
//任务状态需要判断
}
if (point == null) {
throw new BadRequestException(row.getString("turnin_struct_code") + "仓位数据异常,找不到对应点位!");
}

View File

@@ -27,6 +27,8 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -966,7 +968,9 @@ public class ShutFrameServiceImpl implements ShutFrameService {
jo.put("bill_table", "ST_IVT_MoveInv");
storPublicService.IOStor(jo, "33");
double left = jo.getDoubleValue("qty") - jo.getDoubleValue("fact_qty");
BigDecimal qty = new BigDecimal(jo.getDoubleValue("qty")).setScale(3, RoundingMode.HALF_UP);
BigDecimal fact_qty = new BigDecimal(jo.getDoubleValue("fact_qty")).setScale(3, RoundingMode.HALF_UP);
double left = qty.subtract(fact_qty).doubleValue();
if (left > 0) {
//更新移出库存
jo.put("struct_id", jo.getString("turnout_struct_id"));

View File

@@ -109,6 +109,13 @@ public class StatisticalReportController {
return new ResponseEntity<>(statisticalReportService.
query3(whereJson),HttpStatus.OK);
}
@GetMapping("/supplier")
@Log("查询erp供应商")
@ApiOperation("查询erp供应商")
public ResponseEntity<Object> supplier(){
return new ResponseEntity<>(statisticalReportService.
getSupplier(),HttpStatus.OK);
}
@GetMapping("/query4")
@Log("查询月生产计划")
@ApiOperation("查询月生产计划")

View File

@@ -48,6 +48,8 @@ public interface StatisticalReportService {
JSONArray query3(Map whereJson);
JSONArray getSupplier();
JSONArray query4(Map whereJson);

View File

@@ -347,9 +347,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
JSONObject map = new JSONObject();
map.put("flag", "4");
map.put("ext_id", jsonMater.getString("ext_id"));
// JSONObject num_jo = null;
//JSONObject num_jo = null;
JSONObject num_jo = WQL.getWO("QL_ERP").addParamMap(map).setDbname("dataSource1").process().uniqueResult(0);
@@ -539,10 +537,12 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
HashMap<String, String> map = new HashMap<>(whereJson);
String material_id = map.get("material_id");
String sourceName = map.get("source_name");
JSONArray ja = WQL.getWO("statistical_report_query_02")
.addParam("flag", "2")
.addParam("material_id", material_id)
.addParam("source_name", sourceName)
.process().getResultJSONArray(0);
return ja;
}
@@ -552,6 +552,11 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
HashMap<String, String> map = new HashMap<>(whereJson);
WQLObject mater_wql = WQLObject.getWQLObject("md_me_materialbase");
String material_id = map.get("material_id");
String sourceName = map.get("source_name");
String hide = map.get("hide");
if ("false".equals(hide)){
hide= "";
}
String ext_id = "";
if(StrUtil.isNotEmpty(material_id)){
JSONObject mater_jo = mater_wql.query("is_delete='0' and material_id = '" + material_id + "'").uniqueResult(0);
@@ -572,11 +577,22 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
.setDbname("dataSource1")
.addParam("flag", "6")
.addParam("material_id", ext_id)
.addParam("source_name", sourceName)
.addParam("hide", hide)
.addParam("mater_ids", allmaterialId)
.process().getResultJSONArray(0);
return ja;
}
@Override
public JSONArray getSupplier() {
JSONArray ja = WQL.getWO("QL_ERP")
.setDbname("dataSource1")
.addParam("flag", "7")
.process().getResultJSONArray(0);
return ja;
}
@Override
public JSONArray query4(Map whereJson) {
HashMap<String, String> map = new HashMap<>(whereJson);
@@ -722,7 +738,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
list.add(MapOf.ofJ("receive_code", " ","material_code"," ", "material_name"," ","pcsn"," ","receive_qty",rHalfUp,"noin_qty",nHalfUp ,"source_name"," "));
break;
case "3":
headers.putAll(MapOf.of("receive_code", "合同号","material_code","物料编码","material_name","物料名称","sumqty","合同重量","notqty","在途重量","norigtaxprice","含税单价","norigtaxmny","金额","name","供应商"));
headers.putAll(MapOf.of("receive_code", "合同号","material_code","物料编码","material_name","物料名称","sumqty","合同重量","notqty","在途重量","norigtaxprice","含税单价","norigtaxmny","金额","notmny","在途金额","name","供应商"));
list = query3(whereJson);
// byte[] bytes = Files.readAllBytes(Paths.get("/Users/mima0000/Desktop/data.txt"));
// String s = new String(bytes);
@@ -733,18 +749,22 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
String notqty = new BigDecimal(item.getDoubleValue("notqty")).setScale(2, RoundingMode.HALF_UP).toString();
String norigtaxprice = new BigDecimal(item.getDoubleValue("norigtaxprice")).setScale(2, RoundingMode.HALF_UP).toString();
String norigtaxmny = new BigDecimal(item.getDoubleValue("norigtaxmny")).setScale(2, RoundingMode.HALF_UP).toString();
String notmny = new BigDecimal(item.getDoubleValue("notmny")).setScale(2, RoundingMode.HALF_UP).toString();
item.put("sumqty",sumqty);
item.put("notqty",notqty);
item.put("norigtaxprice",norigtaxprice);
item.put("norigtaxmny",norigtaxmny);
item.put("notmny",notmny);
});
double sumqtyD = list.stream().mapToDouble(o -> ((JSONObject) o).getDouble("sumqty")).sum();
double notqtyD = list.stream().mapToDouble(o -> ((JSONObject) o).getDouble("notqty")).sum();
double norigtaxmnyD = list.stream().mapToDouble(o -> ((JSONObject) o).getDouble("norigtaxmny")).sum();
double notmnyD = list.stream().mapToDouble(o -> ((JSONObject) o).getDouble("notmny")).sum();
String sumqtySum = new BigDecimal(sumqtyD).setScale(2, RoundingMode.HALF_UP).toString();
String notqtySum = new BigDecimal(notqtyD).setScale(2, RoundingMode.HALF_UP).toString();
String norigtaxmnySum = new BigDecimal(norigtaxmnyD).setScale(2, RoundingMode.HALF_UP).toString();
list.add(MapOf.ofJ("receive_code", " ","material_code"," ","material_name"," ","sumqty",sumqtySum,"notqty",notqtySum,"norigtaxprice"," ","norigtaxmny",norigtaxmnySum,"name"," "));
String notmnySum = new BigDecimal(notmnyD).setScale(2, RoundingMode.HALF_UP).toString();
list.add(MapOf.ofJ("receive_code", " ","material_code"," ","material_name"," ","sumqty",sumqtySum,"notqty",notqtySum,"norigtaxprice"," ","norigtaxmny",norigtaxmnySum,"notmny",notmnySum,"name"," "));
break;
default: ;
}

View File

@@ -20,6 +20,7 @@
输入.end_date TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.material_code TYPEAS s_string
输入.source_name TYPEAS s_string
输入.storagevehicle_code TYPEAS s_string
输入.bill_code TYPEAS s_string
输入.io_type TYPEAS s_string
@@ -106,6 +107,9 @@
OPTION 输入.material_id <> ""
dtl.material_id = 输入.material_id
ENDOPTION
OPTION 输入.source_name <> ""
mst.source_name like "%" 输入.source_name "%"
ENDOPTION
order by mater.material_code
ENDSELECT
ENDQUERY

View File

@@ -14,6 +14,22 @@ erp:
password: 123456
#配置数据源
spring:
data:
elasticsearch:
repositories:
enabled: true
client:
reactive:
#endpoints: 172.31.185.110:9200,172.31.154.9:9200 #内网
endpoints: 10.16.1.24:9200 #外网
# endpoints: http://10.1.3.90:9200 #外网
elasticsearch:
rest:
#uris: 172.31.185.110:9200,172.31.154.9:9200 #内网
uris: 10.16.1.24:9200 #外网
# uris: http://10.1.3.90:9200 #外网
# username: elastic
# password: 123456
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
@@ -53,16 +69,8 @@ spring:
reset-enable: false
login-username: admin
login-password: 123456
filter:
stat:
enabled: true
# 记录慢SQL
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
filters:
DruidFilter,stat
redis:
#数据库索引
database: ${REDIS_DB:15}
@@ -158,3 +166,5 @@ logging:
file:
path: /app/jar/logs
config: classpath:logback-spring.xml
es:
index: whxr_log

View File

@@ -2,7 +2,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data:

View File

@@ -2,6 +2,67 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.16.1.24:9200/_bulk</url>
<index>${esIndex}</index>
<type>whxr_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>mes</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE3" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -22,6 +83,7 @@
<logger name="org.nl.ext.lk.service.impl.LkToWmsServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE3"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.16.1.24:9200/_bulk</url>
<index>${esIndex}</index>
<type>whxr_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>mes</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE2" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -22,6 +82,7 @@
<logger name="org.nl.wms.st.returns.service.impl.InAndOutRetrunServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE2"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.16.1.24:9200/_bulk</url>
<index>${esIndex}</index>
<type>whxr_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>mes</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE4" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -22,6 +82,7 @@
<logger name="org.nl.ext.lk.service.impl.WmsToLkServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE4"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.16.1.24:9200/_bulk</url>
<index>${esIndex}</index>
<type>whxr_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>mes</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE1" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">

View File

@@ -50,7 +50,7 @@ https://juejin.cn/post/6844903775631572999
</appender>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://47.96.133.178:8200/_bulk</url>
<url>http://10.16.1.24:9200/_bulk</url>
<index>${esIndex}</index>
<type>whxr_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
@@ -123,7 +123,7 @@ https://juejin.cn/post/6844903775631572999
<appender-ref ref="esLogAppender"/>
<appender-ref ref="CONSOLE"/>
</root>
<logger name="es-logger" level="info" additivity="false">
<logger name="es-logger" level="warn" additivity="false">
<appender-ref ref="esLogAppender"/>
<appender-ref ref="CONSOLE"/>
</logger>

View File

@@ -46,6 +46,13 @@ export function query3(params) {
})
}
export function supplier() {
return request({
url: 'api/statistical/supplier',
method: 'get'
})
}
export function query4(params) {
return request({
url: 'api/statistical/query4',
@@ -62,4 +69,4 @@ export function confirmOutStore(data) {
})
}
export default { getHeader, getHeader2, materPlanDtlQuery, query1, query2, query3, query4, confirmOutStore }
export default { getHeader, getHeader2, materPlanDtlQuery, query1, query2, query3, query4, supplier, confirmOutStore }

View File

@@ -1,9 +1,9 @@
<template>
<el-dialog
v-loading.fullscreen.lock="fullscreenLoading"
append-to-body
title="待检入库量"
:visible.sync="dialogVisible"
v-loading.fullscreen.lock="fullscreenLoading"
destroy-on-close
:show-close="false"
fullscreen
@@ -13,39 +13,48 @@
<el-row :gutter="20">
<el-col :span="20" style="border: 1px solid white">
物料:<el-select
v-model="queryrow.material_id"
clearable
size="mini"
placeholder="请选择物料"
style="width: 200px"
class="filter-item"
@change="MyQuery"
>
<el-option
v-for="item in XLList"
:key="item.material_id"
:label="item.material_name"
:value="item.material_id"
/>
v-model="queryrow.material_id"
clearable
size="mini"
placeholder="请选择物料"
style="width: 200px"
class="filter-item"
@change="MyQuery"
>
<el-option
v-for="item in XLList"
:key="item.material_id"
:label="item.material_name"
:value="item.material_id"
/>
</el-select>
供应商:<el-input
v-model="queryrow.source_name"
size="mini"
style="width: 200px"
clearable
placeholder="模糊查询"
@change="MyQuery3"
/>
</el-col>
<el-col :span="4">
<span>
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="success" @click="MyQuery2">查询</el-button>
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button
slot="right"
class="filter-item"
type="success"
size="mini"
@click="downExcel"
>
</el-row>
<el-col :span="4">
<span>
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="success" @click="MyQuery2">查询</el-button>
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button
slot="right"
class="filter-item"
type="success"
size="mini"
@click="downExcel"
>
导出Excel
</el-button>
</span>
</el-col>
</span>
</el-col>
</el-row>
<!--表格渲染-->
<el-table
@@ -66,7 +75,7 @@
<el-table-column prop="pcsn" label="批次" min-width="100" />
<el-table-column prop="receive_qty" label="订单重量" min-width="100" :formatter="crud.formatNum2" />
<el-table-column prop="noin_qty" label="剩余重量" min-width="100" :formatter="crud.formatNum2" />
<el-table-column prop="source_name" label="供应商" min-width="100" />
<el-table-column prop="source_name" label="供应商" min-width="100" />
</el-table>
</el-dialog>
</template>
@@ -98,7 +107,7 @@ export default {
cxjList: [],
XLList: [],
fullscreenLoading: false,
queryrow: { material_id: '' },
queryrow: { material_id: '', source_name: '' },
sortable: null,
rows: []
}
@@ -151,6 +160,7 @@ export default {
},
close() {
this.queryrow.material_id = ''
this.queryrow.source_name = ''
this.tableDtl = []
this.$emit('update:dialogShow', false)
},
@@ -164,6 +174,16 @@ export default {
this.fullscreenLoading = false
})
},
MyQuery3(value) {
this.queryrow.source_name = value
this.fullscreenLoading = true
report.query2(this.queryrow).then(res => {
this.tableDtl = res
this.fullscreenLoading = false
}).catch(() => {
this.fullscreenLoading = false
})
},
getSummaries(param) {
const { columns, data } = param
const sums = []

View File

@@ -28,6 +28,27 @@
:value="item.material_id"
/>
</el-select>
供应商:<el-select
v-model="queryrow.source_name"
clearable
size="mini"
placeholder="供应商"
class="filter-item"
@change="MyQuery3"
>
<el-option
v-for="item in Depts"
:key="item.index"
:label="item.name"
:value="item.name"
>
</el-option>
</el-select>
<el-checkbox
v-model="queryrow.hide"
style="color: red"
@change="MyQuery4"
>隐藏在途重量为零</el-checkbox>
</el-col>
<el-col :span="4">
<span>
@@ -42,8 +63,8 @@
size="mini"
@click="downExcel"
>
导出Excel
</el-button>
导出Excel
</el-button>
</span>
</el-col>
</el-row>
@@ -67,6 +88,7 @@
<el-table-column prop="notqty" label="在途重量" min-width="100" :formatter="crud.formatNum2" />
<el-table-column prop="norigtaxprice" label="含税单价" min-width="100" :formatter="crud.formatNum2" />
<el-table-column prop="norigtaxmny" label="金额" min-width="100" :formatter="crud.formatNum2" />
<el-table-column prop="notmny" label="在途金额" min-width="100" :formatter="crud.formatNum2" />
<el-table-column prop="name" label="供应商" min-width="150" />
</el-table>
</el-dialog>
@@ -99,8 +121,9 @@ export default {
cxjList: [],
XLList: [],
fullscreenLoading: false,
queryrow: { material_id: '' },
queryrow: { material_id: '', source_name: '', hide: true },
sortable: null,
Depts: [],
rows: []
}
},
@@ -133,6 +156,10 @@ export default {
this.XLList = res
})
this.MyQuery2()
report.supplier().then(res => {
debugger
this.Depts = res
})
},
/**
* 接受父组件传值
@@ -152,6 +179,8 @@ export default {
},
close() {
this.queryrow.material_id = ''
this.queryrow.source_name = ''
this.queryrow.hide = true
this.tableDtl = []
this.$emit('update:dialogShow', false)
},
@@ -165,6 +194,26 @@ export default {
this.fullscreenLoading = false
})
},
MyQuery3(value) {
this.queryrow.source_name = value
this.fullscreenLoading = true
report.query3(this.queryrow).then(res => {
this.tableDtl = res
this.fullscreenLoading = false
}).catch(() => {
this.fullscreenLoading = false
})
},
MyQuery4(value) {
this.queryrow.hide = value
this.fullscreenLoading = true
report.query3(this.queryrow).then(res => {
this.tableDtl = res
this.fullscreenLoading = false
}).catch(() => {
this.fullscreenLoading = false
})
},
getSummaries(param) {
const { columns, data } = param
const sums = []
@@ -212,6 +261,18 @@ export default {
sums[index] = parseFloat(total).toFixed(3)
sums[index]
}
if (column.property === 'notmny') {
const total = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = parseFloat(total).toFixed(3)
sums[index]
}
})
return sums
},

View File

@@ -12,16 +12,16 @@
label-suffix=":"
>
<el-form-item label="统计日期">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@input="onInput()"
@change="mytoQuery"
/>
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@input="onInput()"
@change="mytoQuery"
/>
</el-form-item>
<el-form-item label="所属组织">
<el-select
@@ -69,7 +69,9 @@
</el-table-column>
</template>
</el-table>
<div ref="topScroll" class="top-scroll" @scroll="handleScrollTop">
<div class="top-scroll-content" :style="{ width: topScrollWidth }" />
</div>
<el-table
ref="dtl_table"
v-loading="crud.loading"
@@ -94,13 +96,24 @@
</div>
</template>
<style>
/*顶部滚动条*/
.top-scroll {
overflow-x: auto;
overflow-y: hidden;
}
.top-scroll .top-scroll-content {
background-color: #fff;
height: 15px;
}
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
background: #f0f9eb;
}
.el-table__body-wrapper {
display: block;
}
</style>
<script>
import report from '@/api/wms/statistics/report'
@@ -140,6 +153,7 @@ export default {
},
data() {
return {
topScrollWidth: 10,
cols: [],
cols2: [],
dtlList: [],
@@ -163,6 +177,12 @@ export default {
this.crud.query.createTime = [new Date(), new Date().daysLater(30)]
},
methods: {
handleScrollTop() {
if (this.$refs.topScroll) {
var scrollLeft = this.$refs.topScroll.scrollLeft
this.$refs.dtl_table.bodyWrapper.scrollTo(scrollLeft, 0)
}
},
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
report.getHeader().then(res => {
@@ -179,6 +199,12 @@ export default {
const data = this.crud.query
report.materPlanDtlQuery(data).then(res => {
this.dtlList = res.content
this.topScrollWidth = this.$refs.dtl_table.bodyWrapper.scrollWidth + 'px'
this.tableDom = this.$refs.dtl_table.bodyWrapper
this.tableDom.addEventListener('scroll', () => {
var scrollLeft = this.tableDom.scrollLeft
this.$refs.topScroll.scrollTo(scrollLeft, 0)
})
})
crudInspectionsheetmst.getStatus().then(res => {
this.statusList = res