增加销售订单与采购订单的关联

This commit is contained in:
季圣华
2022-05-18 00:21:15 +08:00
parent 14d5c5247d
commit 3438524a47
12 changed files with 305 additions and 35 deletions

View File

@@ -164,6 +164,7 @@ CREATE TABLE `jsh_depot_head` (
`discount_last_money` decimal(24,6) DEFAULT NULL COMMENT '优惠后金额',
`other_money` decimal(24,6) DEFAULT NULL COMMENT '销售或采购费用合计',
`status` varchar(1) DEFAULT NULL COMMENT '状态0未审核、1已审核、2完成采购|销售、3部分采购|销售',
`purchase_status` varchar(1) DEFAULT NULL COMMENT '采购状态0未采购、2完成采购、3部分采购',
`link_number` varchar(50) DEFAULT NULL COMMENT '关联订单号',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除',
@@ -175,22 +176,22 @@ CREATE TABLE `jsh_depot_head` (
-- ----------------------------
-- Records of jsh_depot_head
-- ----------------------------
INSERT INTO `jsh_depot_head` VALUES ('258', '其它', '采购订单', 'CGDD00000000630', 'CGDD00000000630', '2021-06-02 00:21:54', '2021-06-02 00:21:44', '57', '63', null, null, null, '-110.000000', '现付', null, null, null, null, null, null, null, null, null, null, '2', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('259', '入库', '采购', 'CGRK00000000631', 'CGRK00000000631', '2021-06-02 00:22:23', '2021-06-02 00:22:05', '57', '63', '17', '-110.000000', null, '-110.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '110.000000', '0.000000', '0', 'CGDD00000000630', '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('260', '出库', '采购退货', 'CGTH00000000632', 'CGTH00000000632', '2021-06-02 00:22:35', '2021-06-02 00:22:26', '57', '63', '17', '22.000000', null, '22.000000', '现付', null, null, null, null, null, null, '0.000000', '0.000000', '22.000000', '0.000000', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('261', '其它', '销售订单', 'XSDD00000000633', 'XSDD00000000633', '2021-06-02 00:22:48', '2021-06-02 00:22:39', '58', '63', null, null, null, '44.000000', '现付', null, null, null, '', null, null, null, null, null, null, '2', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('262', '出库', '销售', 'XSCK00000000634', 'XSCK00000000634', '2021-06-02 00:23:03', '2021-06-02 00:22:54', '58', '63', '17', '44.000000', null, '44.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '44.000000', '0.000000', '0', 'XSDD00000000633', '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('263', '入库', '销售退货', 'XSTH00000000635', 'XSTH00000000635', '2021-06-02 00:23:12', '2021-06-02 00:23:05', '71', '63', '17', '-22.000000', null, '-22.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '22.000000', '0.000000', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('264', '出库', '零售', 'LSCK00000000636', 'LSCK00000000636', '2021-06-02 00:23:21', '2021-06-02 00:23:14', '60', '63', '17', '22.000000', null, '22.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('265', '入库', '零售退货', 'LSTH00000000637', 'LSTH00000000637', '2021-06-02 00:23:29', '2021-06-02 00:23:23', '60', '63', '17', '-22.000000', null, '-22.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('266', '入库', '其它', 'QTRK00000000638', 'QTRK00000000638', '2021-06-02 00:23:48', '2021-06-02 00:23:36', '57', '63', null, null, null, '-55.000000', '现付', null, null, null, null, null, null, null, null, null, null, '1', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('267', '出库', '其它', 'QTCK00000000639', 'QTCK00000000639', '2021-06-02 00:23:59', '2021-06-02 00:23:50', '58', '63', null, null, null, '30.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('268', '出库', '调拨', 'DBCK00000000640', 'DBCK00000000640', '2021-06-02 00:24:09', '2021-06-02 00:24:00', null, '63', null, null, null, '11.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('269', '其它', '组装单', 'ZZD00000000641', 'ZZD00000000641', '2021-06-02 00:24:29', '2021-06-02 00:24:11', null, '63', null, null, null, '0.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('270', '其它', '拆卸单', 'CXD00000000642', 'CXD00000000642', '2021-06-02 00:24:45', '2021-06-02 00:24:32', null, '63', null, null, null, '0.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('271', '入库', '采购', 'CGRK00000000651', 'CGRK00000000651', '2021-07-06 23:45:20', '2021-07-06 23:44:45', '57', '63', '17', '-20.000000', null, '-80.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '80.000000', '0.000000', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('272', '出库', '销售', 'XSCK00000000652', 'XSCK00000000652', '2021-07-06 23:46:07', '2021-07-06 23:45:24', '58', '63', '17', '8.000000', null, '28.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '28.000000', '0.000000', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('273', '入库', '采购', 'CGRK00000000658', 'CGRK00000000658', '2021-07-28 00:58:12', '2021-07-28 00:58:02', '57', '63', '17', '-60.000000', null, '-60.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '60.000000', '0.000000', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('258', '其它', '采购订单', 'CGDD00000000630', 'CGDD00000000630', '2021-06-02 00:21:54', '2021-06-02 00:21:44', '57', '63', null, null, null, '-110.000000', '现付', null, null, null, null, null, null, null, null, null, null, '2', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('259', '入库', '采购', 'CGRK00000000631', 'CGRK00000000631', '2021-06-02 00:22:23', '2021-06-02 00:22:05', '57', '63', '17', '-110.000000', null, '-110.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '110.000000', '0.000000', '0', '0', 'CGDD00000000630', '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('260', '出库', '采购退货', 'CGTH00000000632', 'CGTH00000000632', '2021-06-02 00:22:35', '2021-06-02 00:22:26', '57', '63', '17', '22.000000', null, '22.000000', '现付', null, null, null, null, null, null, '0.000000', '0.000000', '22.000000', '0.000000', '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('261', '其它', '销售订单', 'XSDD00000000633', 'XSDD00000000633', '2021-06-02 00:22:48', '2021-06-02 00:22:39', '58', '63', null, null, null, '44.000000', '现付', null, null, null, '', null, null, null, null, null, null, '2', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('262', '出库', '销售', 'XSCK00000000634', 'XSCK00000000634', '2021-06-02 00:23:03', '2021-06-02 00:22:54', '58', '63', '17', '44.000000', null, '44.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '44.000000', '0.000000', '0', '0', 'XSDD00000000633', '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('263', '入库', '销售退货', 'XSTH00000000635', 'XSTH00000000635', '2021-06-02 00:23:12', '2021-06-02 00:23:05', '71', '63', '17', '-22.000000', null, '-22.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '22.000000', '0.000000', '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('264', '出库', '零售', 'LSCK00000000636', 'LSCK00000000636', '2021-06-02 00:23:21', '2021-06-02 00:23:14', '60', '63', '17', '22.000000', null, '22.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('265', '入库', '零售退货', 'LSTH00000000637', 'LSTH00000000637', '2021-06-02 00:23:29', '2021-06-02 00:23:23', '60', '63', '17', '-22.000000', null, '-22.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('266', '入库', '其它', 'QTRK00000000638', 'QTRK00000000638', '2021-06-02 00:23:48', '2021-06-02 00:23:36', '57', '63', null, null, null, '-55.000000', '现付', null, null, null, null, null, null, null, null, null, null, '1', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('267', '出库', '其它', 'QTCK00000000639', 'QTCK00000000639', '2021-06-02 00:23:59', '2021-06-02 00:23:50', '58', '63', null, null, null, '30.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('268', '出库', '调拨', 'DBCK00000000640', 'DBCK00000000640', '2021-06-02 00:24:09', '2021-06-02 00:24:00', null, '63', null, null, null, '11.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('269', '其它', '组装单', 'ZZD00000000641', 'ZZD00000000641', '2021-06-02 00:24:29', '2021-06-02 00:24:11', null, '63', null, null, null, '0.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('270', '其它', '拆卸单', 'CXD00000000642', 'CXD00000000642', '2021-06-02 00:24:45', '2021-06-02 00:24:32', null, '63', null, null, null, '0.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('271', '入库', '采购', 'CGRK00000000651', 'CGRK00000000651', '2021-07-06 23:45:20', '2021-07-06 23:44:45', '57', '63', '17', '-20.000000', null, '-80.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '80.000000', '0.000000', '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('272', '出库', '销售', 'XSCK00000000652', 'XSCK00000000652', '2021-07-06 23:46:07', '2021-07-06 23:45:24', '58', '63', '17', '8.000000', null, '28.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '28.000000', '0.000000', '0', '0', null, '63', '0');
INSERT INTO `jsh_depot_head` VALUES ('273', '入库', '采购', 'CGRK00000000658', 'CGRK00000000658', '2021-07-28 00:58:12', '2021-07-28 00:58:02', '57', '63', '17', '-60.000000', null, '-60.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '60.000000', '0.000000', '0', '0', null, '63', '0');
-- ----------------------------
-- Table structure for jsh_depot_item
@@ -829,6 +830,7 @@ CREATE TABLE `jsh_system_config` (
`depot_flag` varchar(1) DEFAULT '0' COMMENT '仓库启用标记0未启用1启用',
`customer_flag` varchar(1) DEFAULT '0' COMMENT '客户启用标记0未启用1启用',
`minus_stock_flag` varchar(1) DEFAULT '0' COMMENT '负库存启用标记0未启用1启用',
`purchase_by_sale_flag` varchar(1) DEFAULT '0' COMMENT '以销定购启用标记0未启用1启用',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除',
PRIMARY KEY (`id`)
@@ -837,7 +839,7 @@ CREATE TABLE `jsh_system_config` (
-- ----------------------------
-- Records of jsh_system_config
-- ----------------------------
INSERT INTO `jsh_system_config` VALUES ('11', '公司test', '小李', '地址1', '12345678', null, null, '注:本单为我公司与客户约定账期内结款的依据,由客户或其单位员工签字生效,并承担法律责任。', '0', '0', '1', '63', '0');
INSERT INTO `jsh_system_config` VALUES ('11', '公司test', '小李', '地址1', '12345678', null, null, '注:本单为我公司与客户约定账期内结款的依据,由客户或其单位员工签字生效,并承担法律责任。', '0', '0', '1', '0', '63', '0');
-- ----------------------------
-- Table structure for jsh_tenant

View File

@@ -1344,3 +1344,13 @@ alter table jsh_material change name name varchar(100) DEFAULT NULL COMMENT '名
-- 给系统参数表增加销售协议字段
-- --------------------------------------------------------
alter table jsh_system_config add sale_agreement varchar(500) DEFAULT NULL COMMENT '销售协议' after company_post_code;
-- --------------------------------------------------------
-- 时间 2022年05月17日
-- by jishenghua
-- 给单据主表增加采购状态字段
-- 给系统参数表增加以销定购开关字段
-- --------------------------------------------------------
alter table jsh_depot_head add purchase_status varchar(1) DEFAULT NULL COMMENT '采购状态0未采购、2完成采购、3部分采购' after status;
alter table jsh_system_config add purchase_by_sale_flag varchar(1) DEFAULT '0' COMMENT '以销定购启用标记0未启用1启用' after minus_stock_flag;
update jsh_depot_head set purchase_status='0';

View File

@@ -67,6 +67,12 @@ public class BusinessConstants {
public static final String BILLS_STATUS_AUDIT = "1";
public static final String BILLS_STATUS_SKIPED = "2";
public static final String BILLS_STATUS_SKIPING = "3";
/**
* 单据-采购状态 purchaseStatus '0'未采购、'2'完成采购、'3'部分采购
* */
public static final String PURCHASE_STATUS_UN_AUDIT = "0";
public static final String PURCHASE_STATUS_SKIPED = "2";
public static final String PURCHASE_STATUS_SKIPING = "3";
/**
* 出入库分类
*采购、采购退货、其它、零售、销售、调拨、盘点复盘等

View File

@@ -168,6 +168,7 @@ public class DepotItemController {
@ApiOperation(value = "单据明细列表")
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
@RequestParam("mpList") String mpList,
@RequestParam(value = "linkType", required = false) String linkType,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
@@ -183,6 +184,7 @@ public class DepotItemController {
if (null != dataList) {
for (DepotItemVo4WithInfoEx diEx : dataList) {
JSONObject item = new JSONObject();
item.put("id", diEx.getId());
item.put("materialExtendId", diEx.getMaterialExtendId() == null ? "" : diEx.getMaterialExtendId());
item.put("barCode", diEx.getBarCode());
item.put("name", diEx.getMName());
@@ -212,7 +214,7 @@ public class DepotItemController {
item.put("operNumber", diEx.getOperNumber());
item.put("basicNumber", diEx.getBasicNumber());
item.put("preNumber", diEx.getOperNumber()); //原数量
item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialExtendId(), diEx.getHeaderId(), unitInfo, materialUnit)); //已入库|已出库
item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialExtendId(), diEx.getHeaderId(), unitInfo, materialUnit, linkType)); //已入库|已出库
item.put("unitPrice", diEx.getUnitPrice());
item.put("taxUnitPrice", diEx.getTaxUnitPrice());
item.put("allPrice", diEx.getAllPrice());

View File

@@ -54,6 +54,8 @@ public class DepotHead {
private String status;
private String purchaseStatus;
private String linkNumber;
private Long tenantId;
@@ -260,6 +262,14 @@ public class DepotHead {
this.status = status == null ? null : status.trim();
}
public String getPurchaseStatus() {
return purchaseStatus;
}
public void setPurchaseStatus(String purchaseStatus) {
this.purchaseStatus = purchaseStatus == null ? null : purchaseStatus.trim();
}
public String getLinkNumber() {
return linkNumber;
}

View File

@@ -1726,6 +1726,76 @@ public class DepotHeadExample {
return (Criteria) this;
}
public Criteria andPurchaseStatusIsNull() {
addCriterion("purchase_status is null");
return (Criteria) this;
}
public Criteria andPurchaseStatusIsNotNull() {
addCriterion("purchase_status is not null");
return (Criteria) this;
}
public Criteria andPurchaseStatusEqualTo(String value) {
addCriterion("purchase_status =", value, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusNotEqualTo(String value) {
addCriterion("purchase_status <>", value, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusGreaterThan(String value) {
addCriterion("purchase_status >", value, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusGreaterThanOrEqualTo(String value) {
addCriterion("purchase_status >=", value, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusLessThan(String value) {
addCriterion("purchase_status <", value, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusLessThanOrEqualTo(String value) {
addCriterion("purchase_status <=", value, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusLike(String value) {
addCriterion("purchase_status like", value, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusNotLike(String value) {
addCriterion("purchase_status not like", value, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusIn(List<String> values) {
addCriterion("purchase_status in", values, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusNotIn(List<String> values) {
addCriterion("purchase_status not in", values, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusBetween(String value1, String value2) {
addCriterion("purchase_status between", value1, value2, "purchaseStatus");
return (Criteria) this;
}
public Criteria andPurchaseStatusNotBetween(String value1, String value2) {
addCriterion("purchase_status not between", value1, value2, "purchaseStatus");
return (Criteria) this;
}
public Criteria andLinkNumberIsNull() {
addCriterion("link_number is null");
return (Criteria) this;

View File

@@ -23,6 +23,8 @@ public class SystemConfig {
private String minusStockFlag;
private String purchaseBySaleFlag;
private Long tenantId;
private String deleteFlag;
@@ -115,6 +117,14 @@ public class SystemConfig {
this.minusStockFlag = minusStockFlag == null ? null : minusStockFlag.trim();
}
public String getPurchaseBySaleFlag() {
return purchaseBySaleFlag;
}
public void setPurchaseBySaleFlag(String purchaseBySaleFlag) {
this.purchaseBySaleFlag = purchaseBySaleFlag == null ? null : purchaseBySaleFlag.trim();
}
public Long getTenantId() {
return tenantId;
}

View File

@@ -864,6 +864,76 @@ public class SystemConfigExample {
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagIsNull() {
addCriterion("purchase_by_sale_flag is null");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagIsNotNull() {
addCriterion("purchase_by_sale_flag is not null");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagEqualTo(String value) {
addCriterion("purchase_by_sale_flag =", value, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagNotEqualTo(String value) {
addCriterion("purchase_by_sale_flag <>", value, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagGreaterThan(String value) {
addCriterion("purchase_by_sale_flag >", value, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagGreaterThanOrEqualTo(String value) {
addCriterion("purchase_by_sale_flag >=", value, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagLessThan(String value) {
addCriterion("purchase_by_sale_flag <", value, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagLessThanOrEqualTo(String value) {
addCriterion("purchase_by_sale_flag <=", value, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagLike(String value) {
addCriterion("purchase_by_sale_flag like", value, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagNotLike(String value) {
addCriterion("purchase_by_sale_flag not like", value, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagIn(List<String> values) {
addCriterion("purchase_by_sale_flag in", values, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagNotIn(List<String> values) {
addCriterion("purchase_by_sale_flag not in", values, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagBetween(String value1, String value2) {
addCriterion("purchase_by_sale_flag between", value1, value2, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andPurchaseBySaleFlagNotBetween(String value1, String value2) {
addCriterion("purchase_by_sale_flag not between", value1, value2, "purchaseBySaleFlag");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;

View File

@@ -325,6 +325,23 @@ public class DepotHeadService {
depotHeadMapper.updateByExampleSelective(dh, example);
}
}
//将关联的销售订单单据置为未采购状态-针对销售订单转采购订单的情况
if(StringUtil.isNotEmpty(depotHead.getLinkNumber())){
if(BusinessConstants.DEPOTHEAD_TYPE_OTHER.equals(depotHead.getType()) &&
BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())) {
DepotHead dh = new DepotHead();
//获取分批操作后单据的商品和商品数量(汇总)
List<DepotItemVo4MaterialAndSum> batchList = depotItemMapperEx.getBatchBillDetailMaterialSum(depotHead.getLinkNumber(), depotHead.getType());
if(batchList.size()>0) {
dh.setPurchaseStatus(BusinessConstants.PURCHASE_STATUS_SKIPING);
} else {
dh.setPurchaseStatus(BusinessConstants.PURCHASE_STATUS_UN_AUDIT);
}
DepotHeadExample example = new DepotHeadExample();
example.createCriteria().andNumberEqualTo(depotHead.getLinkNumber());
depotHeadMapper.updateByExampleSelective(dh, example);
}
}
//更新当前库存
for (DepotItem depotItem : list) {
depotItemService.updateCurrentStock(depotItem);
@@ -713,6 +730,7 @@ public class DepotHeadService {
depotHead.setCreator(userInfo==null?null:userInfo.getId());
depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
depotHead.setPurchaseStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
depotHead.setPayType(depotHead.getPayType()==null?"现付":depotHead.getPayType());
if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));

View File

@@ -566,6 +566,13 @@ public class DepotItemService {
changeBillStatus(depotHead, billStatus);
}
}
//如果关联单据号非空则更新订单的状态,此处针对销售订单转采购订单的场景
if(BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())) {
if(StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
String billStatus = getBillStatusByParam(depotHead);
changeBillPurchaseStatus(depotHead, billStatus);
}
}
} else {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_ROW_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_ROW_FAILED_MSG));
@@ -623,6 +630,27 @@ public class DepotItemService {
}
}
/**
* 更新单据状态,此处针对销售订单转采购订单的场景
* @param depotHead
* @param billStatus
*/
public void changeBillPurchaseStatus(DepotHead depotHead, String billStatus) {
DepotHead depotHeadOrders = new DepotHead();
depotHeadOrders.setPurchaseStatus(billStatus);
DepotHeadExample example = new DepotHeadExample();
List<String> linkNumberList = StringUtil.strToStringList(depotHead.getLinkNumber());
example.createCriteria().andNumberIn(linkNumberList);
try{
depotHeadMapper.updateByExampleSelective(depotHeadOrders, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void deleteDepotItemHeadId(Long headerId)throws Exception {
try{
@@ -810,15 +838,27 @@ public class DepotItemService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public BigDecimal getFinishNumber(Long meId, Long headerId, Unit unitInfo, String materialUnit) {
public BigDecimal getFinishNumber(Long meId, Long headerId, Unit unitInfo, String materialUnit, String linkType) {
String goToType = "";
DepotHead depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
String linkNumber = depotHead.getNumber(); //订单号
if(BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())) {
goToType = BusinessConstants.SUB_TYPE_PURCHASE;
}
if(BusinessConstants.SUB_TYPE_SALES_ORDER.equals(depotHead.getSubType())) {
goToType = BusinessConstants.SUB_TYPE_SALES;
if("purchase".equals(linkType)) {
if(BusinessConstants.SUB_TYPE_SALES_ORDER.equals(depotHead.getSubType())) {
goToType = BusinessConstants.SUB_TYPE_PURCHASE_ORDER;
}
} else {
if(BusinessConstants.PURCHASE_STATUS_SKIPING.equals(depotHead.getPurchaseStatus())) {
if(BusinessConstants.SUB_TYPE_SALES_ORDER.equals(depotHead.getSubType())) {
goToType = BusinessConstants.SUB_TYPE_PURCHASE_ORDER;
}
} else {
if(BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())) {
goToType = BusinessConstants.SUB_TYPE_PURCHASE;
}
if(BusinessConstants.SUB_TYPE_SALES_ORDER.equals(depotHead.getSubType())) {
goToType = BusinessConstants.SUB_TYPE_SALES;
}
}
}
BigDecimal count = depotItemMapperEx.getFinishNumber(meId, linkNumber, goToType);
//根据多单位情况进行数量的转换

View File

@@ -27,6 +27,7 @@
<result column="discount_last_money" jdbcType="DECIMAL" property="discountLastMoney" />
<result column="other_money" jdbcType="DECIMAL" property="otherMoney" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="purchase_status" jdbcType="VARCHAR" property="purchaseStatus" />
<result column="link_number" jdbcType="VARCHAR" property="linkNumber" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
@@ -93,7 +94,8 @@
id, type, sub_type, default_number, number, create_time, oper_time, organ_id, creator,
account_id, change_amount, back_amount, total_price, pay_type, bill_type, remark,
file_name, sales_man, account_id_list, account_money_list, discount, discount_money,
discount_last_money, other_money, status, link_number, tenant_id, delete_flag
discount_last_money, other_money, status, purchase_status, link_number, tenant_id,
delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="BaseResultMap">
select
@@ -134,8 +136,8 @@
remark, file_name, sales_man,
account_id_list, account_money_list, discount,
discount_money, discount_last_money, other_money,
status, link_number, tenant_id,
delete_flag)
status, purchase_status, link_number,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR},
#{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT},
@@ -144,8 +146,8 @@
#{remark,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{salesMan,jdbcType=VARCHAR},
#{accountIdList,jdbcType=VARCHAR}, #{accountMoneyList,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL},
#{discountMoney,jdbcType=DECIMAL}, #{discountLastMoney,jdbcType=DECIMAL}, #{otherMoney,jdbcType=DECIMAL},
#{status,jdbcType=VARCHAR}, #{linkNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
#{status,jdbcType=VARCHAR}, #{purchaseStatus,jdbcType=VARCHAR}, #{linkNumber,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
insert into jsh_depot_head
@@ -225,6 +227,9 @@
<if test="status != null">
status,
</if>
<if test="purchaseStatus != null">
purchase_status,
</if>
<if test="linkNumber != null">
link_number,
</if>
@@ -311,6 +316,9 @@
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="purchaseStatus != null">
#{purchaseStatus,jdbcType=VARCHAR},
</if>
<if test="linkNumber != null">
#{linkNumber,jdbcType=VARCHAR},
</if>
@@ -406,6 +414,9 @@
<if test="record.status != null">
status = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.purchaseStatus != null">
purchase_status = #{record.purchaseStatus,jdbcType=VARCHAR},
</if>
<if test="record.linkNumber != null">
link_number = #{record.linkNumber,jdbcType=VARCHAR},
</if>
@@ -447,6 +458,7 @@
discount_last_money = #{record.discountLastMoney,jdbcType=DECIMAL},
other_money = #{record.otherMoney,jdbcType=DECIMAL},
status = #{record.status,jdbcType=VARCHAR},
purchase_status = #{record.purchaseStatus,jdbcType=VARCHAR},
link_number = #{record.linkNumber,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
@@ -529,6 +541,9 @@
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="purchaseStatus != null">
purchase_status = #{purchaseStatus,jdbcType=VARCHAR},
</if>
<if test="linkNumber != null">
link_number = #{linkNumber,jdbcType=VARCHAR},
</if>
@@ -567,6 +582,7 @@
discount_last_money = #{discountLastMoney,jdbcType=DECIMAL},
other_money = #{otherMoney,jdbcType=DECIMAL},
status = #{status,jdbcType=VARCHAR},
purchase_status = #{purchaseStatus,jdbcType=VARCHAR},
link_number = #{linkNumber,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}

View File

@@ -13,6 +13,7 @@
<result column="depot_flag" jdbcType="VARCHAR" property="depotFlag" />
<result column="customer_flag" jdbcType="VARCHAR" property="customerFlag" />
<result column="minus_stock_flag" jdbcType="VARCHAR" property="minusStockFlag" />
<result column="purchase_by_sale_flag" jdbcType="VARCHAR" property="purchaseBySaleFlag" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
@@ -76,7 +77,8 @@
</sql>
<sql id="Base_Column_List">
id, company_name, company_contacts, company_address, company_tel, company_fax, company_post_code,
sale_agreement, depot_flag, customer_flag, minus_stock_flag, tenant_id, delete_flag
sale_agreement, depot_flag, customer_flag, minus_stock_flag, purchase_by_sale_flag,
tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.SystemConfigExample" resultMap="BaseResultMap">
select
@@ -112,13 +114,13 @@
insert into jsh_system_config (id, company_name, company_contacts,
company_address, company_tel, company_fax,
company_post_code, sale_agreement, depot_flag,
customer_flag, minus_stock_flag, tenant_id,
delete_flag)
customer_flag, minus_stock_flag, purchase_by_sale_flag,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{companyName,jdbcType=VARCHAR}, #{companyContacts,jdbcType=VARCHAR},
#{companyAddress,jdbcType=VARCHAR}, #{companyTel,jdbcType=VARCHAR}, #{companyFax,jdbcType=VARCHAR},
#{companyPostCode,jdbcType=VARCHAR}, #{saleAgreement,jdbcType=VARCHAR}, #{depotFlag,jdbcType=VARCHAR},
#{customerFlag,jdbcType=VARCHAR}, #{minusStockFlag,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
#{customerFlag,jdbcType=VARCHAR}, #{minusStockFlag,jdbcType=VARCHAR}, #{purchaseBySaleFlag,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.SystemConfig">
insert into jsh_system_config
@@ -156,6 +158,9 @@
<if test="minusStockFlag != null">
minus_stock_flag,
</if>
<if test="purchaseBySaleFlag != null">
purchase_by_sale_flag,
</if>
<if test="tenantId != null">
tenant_id,
</if>
@@ -197,6 +202,9 @@
<if test="minusStockFlag != null">
#{minusStockFlag,jdbcType=VARCHAR},
</if>
<if test="purchaseBySaleFlag != null">
#{purchaseBySaleFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
@@ -247,6 +255,9 @@
<if test="record.minusStockFlag != null">
minus_stock_flag = #{record.minusStockFlag,jdbcType=VARCHAR},
</if>
<if test="record.purchaseBySaleFlag != null">
purchase_by_sale_flag = #{record.purchaseBySaleFlag,jdbcType=VARCHAR},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
@@ -271,6 +282,7 @@
depot_flag = #{record.depotFlag,jdbcType=VARCHAR},
customer_flag = #{record.customerFlag,jdbcType=VARCHAR},
minus_stock_flag = #{record.minusStockFlag,jdbcType=VARCHAR},
purchase_by_sale_flag = #{record.purchaseBySaleFlag,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
@@ -310,6 +322,9 @@
<if test="minusStockFlag != null">
minus_stock_flag = #{minusStockFlag,jdbcType=VARCHAR},
</if>
<if test="purchaseBySaleFlag != null">
purchase_by_sale_flag = #{purchaseBySaleFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
@@ -331,6 +346,7 @@
depot_flag = #{depotFlag,jdbcType=VARCHAR},
customer_flag = #{customerFlag,jdbcType=VARCHAR},
minus_stock_flag = #{minusStockFlag,jdbcType=VARCHAR},
purchase_by_sale_flag = #{purchaseBySaleFlag,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}