Browse Source

到货单,运费

yuansh 4 months ago
parent
commit
bf914d743d
32 changed files with 1348 additions and 600 deletions
  1. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurDeliveryNoteArrival.java
  2. 2 2
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrder.java
  3. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProduct.java
  4. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProductHis.java
  5. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurDeliveryNoteArrivalMapper.xml
  6. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurOrderProductMapper.xml
  7. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurShippingFeeServiceImpl.java
  8. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurDeliveryNoteAlert.java
  9. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderAlert.java
  10. 180 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleDeliveryFilesController.java
  11. 95 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleDeliveryFiles.java
  12. 17 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/mapper/SaleDeliveryFilesMapper.java
  13. 5 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/mapper/xml/SaleDeliveryFilesMapper.xml
  14. 14 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/ISaleDeliveryFilesService.java
  15. 19 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleDeliveryFilesServiceImpl.java
  16. 137 137
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/controller/StoreOnhandController.java
  17. 29 0
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/controller/StoreSaleOutController.java
  18. 1 0
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreCheck.java
  19. 1 0
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreOnhand.java
  20. 1 0
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreOtherOut.java
  21. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreOtherOutDetails.java
  22. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreSaleOut.java
  23. 4 2
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreSaleOutDetails.java
  24. 9 1
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/IStoreOnhandService.java
  25. 16 0
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/IStoreSaleOutService.java
  26. 78 18
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StoreCheckServiceImpl.java
  27. 144 12
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StoreOnhandServiceImpl.java
  28. 52 15
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StoreOtherOutServiceImpl.java
  29. 41 20
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StorePurchaseInServiceImpl.java
  30. 243 227
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StorePurchaseOtherServiceImpl.java
  31. 235 166
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StoreSaleOutServiceImpl.java
  32. 1 0
      srm-module-code/src/main/java/org/jeecg/modules/storeCode/vo/StoreSaleOutPage.java

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurDeliveryNoteArrival.java

@@ -86,6 +86,8 @@ public class PurDeliveryNoteArrival implements Serializable {
 	@Excel(name = "产品中文名(chinese name)", width = 15)
 	@Excel(name = "产品中文名(chinese name)", width = 15)
     @ApiModelProperty(value = "产品中文名(chinese name)")
     @ApiModelProperty(value = "产品中文名(chinese name)")
     private String chineseName;
     private String chineseName;
+    private String productCode;
+    private String productClass;
 	/**产品英文名*/
 	/**产品英文名*/
 	@Excel(name = "产品英文名", width = 15)
 	@Excel(name = "产品英文名", width = 15)
     @ApiModelProperty(value = "产品英文名")
     @ApiModelProperty(value = "产品英文名")

+ 2 - 2
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrder.java

@@ -58,8 +58,8 @@ public class PurOrder implements Serializable {
     @ApiModelProperty(value = "更新时间")
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
     private Date updateTime;
 	/**客户确认(1-已确认,0-未确认)*/
 	/**客户确认(1-已确认,0-未确认)*/
-	@Excel(name = "客户确认(1-已确认,0-未确认)", width = 15)
-    @ApiModelProperty(value = "客户确认(1-已确认,0-未确认)")
+	@Excel(name = "供应商确认(1-已确认,0-未确认)", width = 15)
+    @ApiModelProperty(value = "供应商确认(1-已确认,0-未确认)")
     @Dict(dicCode = "customer_confirm")
     @Dict(dicCode = "customer_confirm")
     private Integer status;
     private Integer status;
 	/**提交(submit)1是0否*/
 	/**提交(submit)1是0否*/

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProduct.java

@@ -86,6 +86,8 @@ public class PurOrderProduct implements Serializable {
     @Excel(name = "产品中文名(chinese name)", width = 15)
     @Excel(name = "产品中文名(chinese name)", width = 15)
     @ApiModelProperty(value = "产品中文名(chinese name)")
     @ApiModelProperty(value = "产品中文名(chinese name)")
     private String chineseName;
     private String chineseName;
+    private String productCode;
+    private String productClass;
     /**产品英文名*/
     /**产品英文名*/
     @Excel(name = "产品英文名", width = 15)
     @Excel(name = "产品英文名", width = 15)
     @ApiModelProperty(value = "产品英文名")
     @ApiModelProperty(value = "产品英文名")

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProductHis.java

@@ -86,6 +86,8 @@ public class PurOrderProductHis implements Serializable {
 	@Excel(name = "产品中文名(chinese name)", width = 15)
 	@Excel(name = "产品中文名(chinese name)", width = 15)
     @ApiModelProperty(value = "产品中文名(chinese name)")
     @ApiModelProperty(value = "产品中文名(chinese name)")
     private String chineseName;
     private String chineseName;
+    private String productCode;
+    private String productClass;
 	/**产品英文名*/
 	/**产品英文名*/
 	@Excel(name = "产品英文名", width = 15)
 	@Excel(name = "产品英文名", width = 15)
     @ApiModelProperty(value = "产品英文名")
     @ApiModelProperty(value = "产品英文名")

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurDeliveryNoteArrivalMapper.xml

@@ -24,6 +24,8 @@
                    , a.*
                    , a.*
                    , b.product_id
                    , b.product_id
                    , b.chinese_name
                    , b.chinese_name
+                   , b.product_code
+                   , b.product_class
                    , b.english_name
                    , b.english_name
                    , b.specifications
                    , b.specifications
                    , b.partno
                    , b.partno

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurOrderProductMapper.xml

@@ -25,6 +25,8 @@
 			 , a.*
 			 , a.*
 			 , b.product_id
 			 , b.product_id
 			 , b.chinese_name
 			 , b.chinese_name
+			 , b.product_code
+			 , b.product_class
 			 , b.english_name
 			 , b.english_name
 			 , b.specifications
 			 , b.specifications
 			 , b.partno
 			 , b.partno

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurShippingFeeServiceImpl.java

@@ -38,6 +38,7 @@ public class PurShippingFeeServiceImpl extends ServiceImpl<PurShippingFeeMapper,
 		if(purShippingFeeNoticeList!=null && purShippingFeeNoticeList.size()>0) {
 		if(purShippingFeeNoticeList!=null && purShippingFeeNoticeList.size()>0) {
 			for(PurShippingFeeNotice entity:purShippingFeeNoticeList) {
 			for(PurShippingFeeNotice entity:purShippingFeeNoticeList) {
 				//外键设置
 				//外键设置
+				entity.setId(null);
 				entity.setHeadId(purShippingFee.getId());
 				entity.setHeadId(purShippingFee.getId());
 				purShippingFeeNoticeMapper.insert(entity);
 				purShippingFeeNoticeMapper.insert(entity);
 			}
 			}
@@ -45,6 +46,7 @@ public class PurShippingFeeServiceImpl extends ServiceImpl<PurShippingFeeMapper,
 		if(purShippingFeeProdeuctList!=null && purShippingFeeProdeuctList.size()>0) {
 		if(purShippingFeeProdeuctList!=null && purShippingFeeProdeuctList.size()>0) {
 			for(PurShippingFeeProdeuct entity:purShippingFeeProdeuctList) {
 			for(PurShippingFeeProdeuct entity:purShippingFeeProdeuctList) {
 				//外键设置
 				//外键设置
+				entity.setId(null);
 				entity.setHeadId(purShippingFee.getId());
 				entity.setHeadId(purShippingFee.getId());
 				purShippingFeeProdeuctMapper.insert(entity);
 				purShippingFeeProdeuctMapper.insert(entity);
 			}
 			}
@@ -64,6 +66,7 @@ public class PurShippingFeeServiceImpl extends ServiceImpl<PurShippingFeeMapper,
 		if(purShippingFeeNoticeList!=null && purShippingFeeNoticeList.size()>0) {
 		if(purShippingFeeNoticeList!=null && purShippingFeeNoticeList.size()>0) {
 			for(PurShippingFeeNotice entity:purShippingFeeNoticeList) {
 			for(PurShippingFeeNotice entity:purShippingFeeNoticeList) {
 				//外键设置
 				//外键设置
+				entity.setId(null);
 				entity.setHeadId(purShippingFee.getId());
 				entity.setHeadId(purShippingFee.getId());
 				purShippingFeeNoticeMapper.insert(entity);
 				purShippingFeeNoticeMapper.insert(entity);
 			}
 			}
@@ -71,6 +74,7 @@ public class PurShippingFeeServiceImpl extends ServiceImpl<PurShippingFeeMapper,
 		if(purShippingFeeProdeuctList!=null && purShippingFeeProdeuctList.size()>0) {
 		if(purShippingFeeProdeuctList!=null && purShippingFeeProdeuctList.size()>0) {
 			for(PurShippingFeeProdeuct entity:purShippingFeeProdeuctList) {
 			for(PurShippingFeeProdeuct entity:purShippingFeeProdeuctList) {
 				//外键设置
 				//外键设置
+				entity.setId(null);
 				entity.setHeadId(purShippingFee.getId());
 				entity.setHeadId(purShippingFee.getId());
 				purShippingFeeProdeuctMapper.insert(entity);
 				purShippingFeeProdeuctMapper.insert(entity);
 			}
 			}

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurDeliveryNoteAlert.java

@@ -192,6 +192,8 @@ public class PurDeliveryNoteAlert implements Serializable {
     @Excel(name = "产品中文名(chinese name)", width = 15)
     @Excel(name = "产品中文名(chinese name)", width = 15)
     @ApiModelProperty(value = "产品中文名(chinese name)")
     @ApiModelProperty(value = "产品中文名(chinese name)")
     private String chineseName;
     private String chineseName;
+    private String productCode;
+    private String productClass;
     /**产品英文名*/
     /**产品英文名*/
     @Excel(name = "产品英文名", width = 15)
     @Excel(name = "产品英文名", width = 15)
     @ApiModelProperty(value = "产品英文名")
     @ApiModelProperty(value = "产品英文名")

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderAlert.java

@@ -219,6 +219,8 @@ public class PurOrderAlert implements Serializable {
     @Excel(name = "产品中文名(chinese name)", width = 15)
     @Excel(name = "产品中文名(chinese name)", width = 15)
     @ApiModelProperty(value = "产品中文名(chinese name)")
     @ApiModelProperty(value = "产品中文名(chinese name)")
     private String chineseName;
     private String chineseName;
+    private String productCode;
+    private String productClass;
     /**产品英文名*/
     /**产品英文名*/
     @Excel(name = "产品英文名", width = 15)
     @Excel(name = "产品英文名", width = 15)
     @ApiModelProperty(value = "产品英文名")
     @ApiModelProperty(value = "产品英文名")

+ 180 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleDeliveryFilesController.java

@@ -0,0 +1,180 @@
+package org.jeecg.modules.saleCode.controller;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.query.QueryRuleEnum;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.saleCode.entity.SaleDeliveryFiles;
+import org.jeecg.modules.saleCode.service.ISaleDeliveryFilesService;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+ /**
+ * @Description: 发货通知单子表 - 文件
+ * @Author: jeecg-boot
+ * @Date:   2024-12-13
+ * @Version: V1.0
+ */
+@Api(tags="发货通知单子表 - 文件")
+@RestController
+@RequestMapping("/saleCode/saleDeliveryFiles")
+@Slf4j
+public class SaleDeliveryFilesController extends JeecgController<SaleDeliveryFiles, ISaleDeliveryFilesService> {
+	@Autowired
+	private ISaleDeliveryFilesService saleDeliveryFilesService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param saleDeliveryFiles
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "发货通知单子表 - 文件-分页列表查询")
+	@ApiOperation(value="发货通知单子表 - 文件-分页列表查询", notes="发货通知单子表 - 文件-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<SaleDeliveryFiles>> queryPageList(SaleDeliveryFiles saleDeliveryFiles,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+        QueryWrapper<SaleDeliveryFiles> queryWrapper = QueryGenerator.initQueryWrapper(saleDeliveryFiles, req.getParameterMap());
+		Page<SaleDeliveryFiles> page = new Page<SaleDeliveryFiles>(pageNo, pageSize);
+		IPage<SaleDeliveryFiles> pageList = saleDeliveryFilesService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   添加
+	 *
+	 * @param saleDeliveryFiles
+	 * @return
+	 */
+	@AutoLog(value = "发货通知单子表 - 文件-添加")
+	@ApiOperation(value="发货通知单子表 - 文件-添加", notes="发货通知单子表 - 文件-添加")
+	@RequiresPermissions("saleCode:sale_delivery_files:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody SaleDeliveryFiles saleDeliveryFiles) {
+		saleDeliveryFilesService.save(saleDeliveryFiles);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 *  编辑
+	 *
+	 * @param saleDeliveryFiles
+	 * @return
+	 */
+	@AutoLog(value = "发货通知单子表 - 文件-编辑")
+	@ApiOperation(value="发货通知单子表 - 文件-编辑", notes="发货通知单子表 - 文件-编辑")
+	@RequiresPermissions("saleCode:sale_delivery_files:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody SaleDeliveryFiles saleDeliveryFiles) {
+		saleDeliveryFilesService.updateById(saleDeliveryFiles);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "发货通知单子表 - 文件-通过id删除")
+	@ApiOperation(value="发货通知单子表 - 文件-通过id删除", notes="发货通知单子表 - 文件-通过id删除")
+	@RequiresPermissions("saleCode:sale_delivery_files:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		saleDeliveryFilesService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "发货通知单子表 - 文件-批量删除")
+	@ApiOperation(value="发货通知单子表 - 文件-批量删除", notes="发货通知单子表 - 文件-批量删除")
+	@RequiresPermissions("saleCode:sale_delivery_files:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.saleDeliveryFilesService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "发货通知单子表 - 文件-通过id查询")
+	@ApiOperation(value="发货通知单子表 - 文件-通过id查询", notes="发货通知单子表 - 文件-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<SaleDeliveryFiles> queryById(@RequestParam(name="id",required=true) String id) {
+		SaleDeliveryFiles saleDeliveryFiles = saleDeliveryFilesService.getById(id);
+		if(saleDeliveryFiles==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(saleDeliveryFiles);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param saleDeliveryFiles
+    */
+    @RequiresPermissions("saleCode:sale_delivery_files:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, SaleDeliveryFiles saleDeliveryFiles) {
+        return super.exportXls(request, saleDeliveryFiles, SaleDeliveryFiles.class, "发货通知单子表 - 文件");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    @RequiresPermissions("saleCode:sale_delivery_files:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, SaleDeliveryFiles.class);
+    }
+
+}

+ 95 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleDeliveryFiles.java

@@ -0,0 +1,95 @@
+package org.jeecg.modules.saleCode.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import org.jeecg.common.constant.ProvinceCityArea;
+import org.jeecg.common.util.SpringContextUtils;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: 发货通知单子表 - 文件
+ * @Author: jeecg-boot
+ * @Date:   2024-12-13
+ * @Version: V1.0
+ */
+@Data
+@TableName("sale_delivery_files")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="sale_delivery_files对象", description="发货通知单子表 - 文件")
+public class SaleDeliveryFiles implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键id*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键id")
+    private String id;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+	/**状态(1-启用,0-停用)*/
+	@Excel(name = "状态(1-启用,0-停用)", width = 15)
+    @ApiModelProperty(value = "状态(1-启用,0-停用)")
+    private Integer status;
+	/**附件(attachs)*/
+	@Excel(name = "附件(attachs)", width = 15)
+    @ApiModelProperty(value = "附件(attachs)")
+    private String attachs;
+	/**附件名称*/
+	@Excel(name = "附件名称", width = 15)
+    @ApiModelProperty(value = "附件名称")
+    private String name;
+	/**
+1清关资料 2证书/报告*/
+	@Excel(name = "1清关资料 2证书/报告", width = 15)
+    @ApiModelProperty(value = "1清关资料 2证书/报告")
+    private java.lang.String type;
+	/**发货单主表主键*/
+	@Excel(name = "发货单主表主键", width = 15)
+    @ApiModelProperty(value = "发货单主表主键")
+    private java.lang.String headId;
+	/**删除标记*/
+	@Excel(name = "删除标记", width = 15)
+    @ApiModelProperty(value = "删除标记")
+    @TableLogic
+    private java.lang.Integer delFlag;
+	/**产品id*/
+	@Excel(name = "产品id", width = 15)
+    @ApiModelProperty(value = "产品id")
+    private java.lang.String productId;
+	/**产品编码*/
+	@Excel(name = "产品编码", width = 15)
+    @ApiModelProperty(value = "产品编码")
+    private java.lang.String productCode;
+	/**产品名称*/
+	@Excel(name = "产品名称", width = 15)
+    @ApiModelProperty(value = "产品名称")
+    private java.lang.String productName;
+}

+ 17 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/mapper/SaleDeliveryFilesMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.saleCode.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.saleCode.entity.SaleDeliveryFiles;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 发货通知单子表 - 文件
+ * @Author: jeecg-boot
+ * @Date:   2024-12-13
+ * @Version: V1.0
+ */
+public interface SaleDeliveryFilesMapper extends BaseMapper<SaleDeliveryFiles> {
+
+}

+ 5 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/mapper/xml/SaleDeliveryFilesMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.saleCode.mapper.SaleDeliveryFilesMapper">
+
+</mapper>

+ 14 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/ISaleDeliveryFilesService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.saleCode.service;
+
+import org.jeecg.modules.saleCode.entity.SaleDeliveryFiles;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 发货通知单子表 - 文件
+ * @Author: jeecg-boot
+ * @Date:   2024-12-13
+ * @Version: V1.0
+ */
+public interface ISaleDeliveryFilesService extends IService<SaleDeliveryFiles> {
+
+}

+ 19 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleDeliveryFilesServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.saleCode.service.impl;
+
+import org.jeecg.modules.saleCode.entity.SaleDeliveryFiles;
+import org.jeecg.modules.saleCode.mapper.SaleDeliveryFilesMapper;
+import org.jeecg.modules.saleCode.service.ISaleDeliveryFilesService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 发货通知单子表 - 文件
+ * @Author: jeecg-boot
+ * @Date:   2024-12-13
+ * @Version: V1.0
+ */
+@Service
+public class SaleDeliveryFilesServiceImpl extends ServiceImpl<SaleDeliveryFilesMapper, SaleDeliveryFiles> implements ISaleDeliveryFilesService {
+
+}

+ 137 - 137
srm-module-code/src/main/java/org/jeecg/modules/storeCode/controller/StoreOnhandController.java

@@ -43,148 +43,148 @@ import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
 
- /**
+/**
  * @Description: 现存量
  * @Description: 现存量
  * @Author: jeecg-boot
  * @Author: jeecg-boot
- * @Date:   2024-12-04
+ * @Date: 2024-12-04
  * @Version: V1.0
  * @Version: V1.0
  */
  */
-@Api(tags="现存量")
+@Api(tags = "现存量")
 @RestController
 @RestController
 @RequestMapping("/storeCode/storeOnhand")
 @RequestMapping("/storeCode/storeOnhand")
 @Slf4j
 @Slf4j
 public class StoreOnhandController extends JeecgController<StoreOnhand, IStoreOnhandService> {
 public class StoreOnhandController extends JeecgController<StoreOnhand, IStoreOnhandService> {
-	@Autowired
-	private IStoreOnhandService storeOnhandService;
-	 @Autowired
-	 private ISerialPatternService serialPatternService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param storeOnhand
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "现存量-分页列表查询")
-	@ApiOperation(value="现存量-分页列表查询", notes="现存量-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<StoreOnhand>> queryPageList(StoreOnhand storeOnhand,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
+    @Autowired
+    private IStoreOnhandService storeOnhandService;
+    @Autowired
+    private ISerialPatternService serialPatternService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param storeOnhand
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "现存量-分页列表查询")
+    @ApiOperation(value = "现存量-分页列表查询", notes = "现存量-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<StoreOnhand>> queryPageList(StoreOnhand storeOnhand,
+                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                    HttpServletRequest req) {
         QueryWrapper<StoreOnhand> queryWrapper = QueryGenerator.initQueryWrapper(storeOnhand, req.getParameterMap());
         QueryWrapper<StoreOnhand> queryWrapper = QueryGenerator.initQueryWrapper(storeOnhand, req.getParameterMap());
-		Page<StoreOnhand> page = new Page<StoreOnhand>(pageNo, pageSize);
-		IPage<StoreOnhand> pageList = storeOnhandService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param storeOnhand
-	 * @return
-	 */
-	@AutoLog(value = "现存量-添加")
-	@ApiOperation(value="现存量-添加", notes="现存量-添加")
-	@RequiresPermissions("storeCode:store_onhand:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody StoreOnhand storeOnhand) {
-
-		String code = storeOnhand.getBatchCode();
-		if (StringUtils.isNotBlank(code)) {
-
-			QueryWrapper<StoreOnhand> queryWrapper = new QueryWrapper();
-			queryWrapper.eq("bill_code", code);
-			queryWrapper.eq("del_flag", "0");
-
-			List<StoreOnhand> list = storeOnhandService.list(queryWrapper);
-			if (list.size() != 0) {
-				return Result.error("现存量批次重复,请修改!");
-			}
-		} else {
-
-			Result<String> result = serialPatternService.getNextSerial("store_onhand", "batch_code");
-			if (!result.isSuccess()) {
-				return result;
-			}
-			storeOnhand.setBatchCode(result.getMessage());
-		}
-
-		storeOnhandService.save(storeOnhand);
-		return Result.OK("添加成功!");
-	}
-	
-	/**
-	 *  编辑
-	 *
-	 * @param storeOnhand
-	 * @return
-	 */
-	@AutoLog(value = "现存量-编辑")
-	@ApiOperation(value="现存量-编辑", notes="现存量-编辑")
-	@RequiresPermissions("storeCode:store_onhand:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody StoreOnhand storeOnhand) {
-		storeOnhandService.updateById(storeOnhand);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "现存量-通过id删除")
-	@ApiOperation(value="现存量-通过id删除", notes="现存量-通过id删除")
-	@RequiresPermissions("storeCode:store_onhand:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		storeOnhandService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "现存量-批量删除")
-	@ApiOperation(value="现存量-批量删除", notes="现存量-批量删除")
-	@RequiresPermissions("storeCode:store_onhand:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.storeOnhandService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "现存量-通过id查询")
-	@ApiOperation(value="现存量-通过id查询", notes="现存量-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<StoreOnhand> queryById(@RequestParam(name="id",required=true) String id) {
-		StoreOnhand storeOnhand = storeOnhandService.getById(id);
-		if(storeOnhand==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(storeOnhand);
-	}
+        Page<StoreOnhand> page = new Page<StoreOnhand>(pageNo, pageSize);
+        IPage<StoreOnhand> pageList = storeOnhandService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param storeOnhand
+     * @return
+     */
+    @AutoLog(value = "现存量-添加")
+    @ApiOperation(value = "现存量-添加", notes = "现存量-添加")
+    @RequiresPermissions("storeCode:store_onhand:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody StoreOnhand storeOnhand) {
+
+        String code = storeOnhand.getBatchCode();
+        if (StringUtils.isNotBlank(code)) {
+
+            QueryWrapper<StoreOnhand> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("bill_code", code);
+            queryWrapper.eq("del_flag", "0");
+
+            List<StoreOnhand> list = storeOnhandService.list(queryWrapper);
+            if (list.size() != 0) {
+                return Result.error("现存量批次重复,请修改!");
+            }
+        } else {
+
+            Result<String> result = serialPatternService.getNextSerial("store_onhand", "batch_code");
+            if (!result.isSuccess()) {
+                return result;
+            }
+            storeOnhand.setBatchCode(result.getMessage());
+        }
+
+        storeOnhandService.save(storeOnhand);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param storeOnhand
+     * @return
+     */
+    @AutoLog(value = "现存量-编辑")
+    @ApiOperation(value = "现存量-编辑", notes = "现存量-编辑")
+    @RequiresPermissions("storeCode:store_onhand:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody StoreOnhand storeOnhand) {
+        storeOnhandService.updateById(storeOnhand);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "现存量-通过id删除")
+    @ApiOperation(value = "现存量-通过id删除", notes = "现存量-通过id删除")
+    @RequiresPermissions("storeCode:store_onhand:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        storeOnhandService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "现存量-批量删除")
+    @ApiOperation(value = "现存量-批量删除", notes = "现存量-批量删除")
+    @RequiresPermissions("storeCode:store_onhand:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.storeOnhandService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "现存量-通过id查询")
+    @ApiOperation(value = "现存量-通过id查询", notes = "现存量-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<StoreOnhand> queryById(@RequestParam(name = "id", required = true) String id) {
+        StoreOnhand storeOnhand = storeOnhandService.getById(id);
+        if (storeOnhand == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(storeOnhand);
+    }
 
 
     /**
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param storeOnhand
-    */
+     * 导出excel
+     *
+     * @param request
+     * @param storeOnhand
+     */
     @RequiresPermissions("storeCode:store_onhand:exportXls")
     @RequiresPermissions("storeCode:store_onhand:exportXls")
     @RequestMapping(value = "/exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, StoreOnhand storeOnhand) {
     public ModelAndView exportXls(HttpServletRequest request, StoreOnhand storeOnhand) {
@@ -192,12 +192,12 @@ public class StoreOnhandController extends JeecgController<StoreOnhand, IStoreOn
     }
     }
 
 
     /**
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("storeCode:store_onhand:importExcel")
     @RequiresPermissions("storeCode:store_onhand:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

+ 29 - 0
srm-module-code/src/main/java/org/jeecg/modules/storeCode/controller/StoreSaleOutController.java

@@ -221,6 +221,35 @@ public class StoreSaleOutController {
         return Result.OK("批量删除成功!");
         return Result.OK("批量删除成功!");
     }
     }
 
 
+    /**
+     * 批量提交
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "销售出库-设置是否出口")
+    @ApiOperation(value = "销售出库-设置是否出口", notes = "销售出库-设置是否出口")
+    @GetMapping(value = "/setExport")
+    public Result<String> setExport(@RequestParam(name = "ids", required = true) String ids,
+                                    @RequestParam(name = "export", required = true) String export) {
+
+        return storeSaleOutService.setExport(ids,export);
+    }
+
+    /**
+     * 批量提交
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "销售出库-开票申请")
+    @ApiOperation(value = "销售出库-开票申请", notes = "销售出库-开票申请")
+    @GetMapping(value = "/applyInvoice")
+    public Result<String> applyInvoice(@RequestParam(name = "ids", required = true) String ids) {
+
+        return storeSaleOutService.applyInvoice(ids);
+    }
+
     /**
     /**
      * 批量提交
      * 批量提交
      *
      *

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreCheck.java

@@ -52,6 +52,7 @@ public class StoreCheck implements Serializable {
 	/**提交(submit)1是0否*/
 	/**提交(submit)1是0否*/
 	@Excel(name = "提交(submit)1是0否", width = 15)
 	@Excel(name = "提交(submit)1是0否", width = 15)
     @ApiModelProperty(value = "提交(submit)1是0否")
     @ApiModelProperty(value = "提交(submit)1是0否")
+    @Dict(dicCode = "yes_or_no")
     private String submit;
     private String submit;
 	/**删除状态(0-正常,1-已删除)*/
 	/**删除状态(0-正常,1-已删除)*/
 	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
 	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreOnhand.java

@@ -96,6 +96,7 @@ public class StoreOnhand implements Serializable {
     @ApiModelProperty(value = "产品分类(production class)")
     @ApiModelProperty(value = "产品分类(production class)")
     @Dict(dictTable = "base_product_class", dicCode = "id", dicText = "name")
     @Dict(dictTable = "base_product_class", dicCode = "id", dicText = "name")
     private String productionClass;
     private String productionClass;
+    private String productionClassName;
 	/**厂家(maker)*/
 	/**厂家(maker)*/
 	@Excel(name = "厂家(maker)", width = 15)
 	@Excel(name = "厂家(maker)", width = 15)
     @ApiModelProperty(value = "厂家(maker)")
     @ApiModelProperty(value = "厂家(maker)")

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreOtherOut.java

@@ -52,6 +52,7 @@ public class StoreOtherOut implements Serializable {
 	/**提交(submit)1是0否*/
 	/**提交(submit)1是0否*/
 	@Excel(name = "提交(submit)1是0否", width = 15)
 	@Excel(name = "提交(submit)1是0否", width = 15)
     @ApiModelProperty(value = "提交(submit)1是0否")
     @ApiModelProperty(value = "提交(submit)1是0否")
+    @Dict(dicCode = "yes_or_no")
     private String submit;
     private String submit;
 	/**删除状态(0-正常,1-已删除)*/
 	/**删除状态(0-正常,1-已删除)*/
 	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
 	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreOtherOutDetails.java

@@ -116,4 +116,6 @@ public class StoreOtherOutDetails implements Serializable {
 	@Excel(name = "来源", width = 15)
 	@Excel(name = "来源", width = 15)
     @ApiModelProperty(value = "来源")
     @ApiModelProperty(value = "来源")
     private String sourceId;
     private String sourceId;
+    //来源批次id
+    private String batchId;
 }
 }

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreSaleOut.java

@@ -52,14 +52,17 @@ public class StoreSaleOut implements Serializable {
 	/**是否出口(export)(1是 0否)*/
 	/**是否出口(export)(1是 0否)*/
 	@Excel(name = "是否出口(export)(1是 0否)", width = 15)
 	@Excel(name = "是否出口(export)(1是 0否)", width = 15)
     @ApiModelProperty(value = "是否出口(export)(1是 0否)")
     @ApiModelProperty(value = "是否出口(export)(1是 0否)")
+    @Dict(dicCode = "yes_or_no")
     private String isExport;
     private String isExport;
 	/**是否开票申请(1是 0否)*/
 	/**是否开票申请(1是 0否)*/
 	@Excel(name = "是否开票申请(1是 0否)", width = 15)
 	@Excel(name = "是否开票申请(1是 0否)", width = 15)
     @ApiModelProperty(value = "是否开票申请(1是 0否)")
     @ApiModelProperty(value = "是否开票申请(1是 0否)")
+    @Dict(dicCode = "yes_or_no")
     private String applyInvoice;
     private String applyInvoice;
 	/**提交(submit)1是0否*/
 	/**提交(submit)1是0否*/
 	@Excel(name = "提交(submit)1是0否", width = 15)
 	@Excel(name = "提交(submit)1是0否", width = 15)
     @ApiModelProperty(value = "提交(submit)1是0否")
     @ApiModelProperty(value = "提交(submit)1是0否")
+    @Dict(dicCode = "yes_or_no")
     private String submit;
     private String submit;
 	/**删除状态(0-正常,1-已删除)*/
 	/**删除状态(0-正常,1-已删除)*/
 	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
 	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
@@ -128,4 +131,5 @@ public class StoreSaleOut implements Serializable {
     private String productionClass;
     private String productionClass;
     private String model;
     private String model;
     private String maker;
     private String maker;
+    private String sourceCode;
 }
 }

+ 4 - 2
srm-module-code/src/main/java/org/jeecg/modules/storeCode/entity/StoreSaleOutDetails.java

@@ -123,7 +123,9 @@ public class StoreSaleOutDetails implements Serializable {
     @ApiModelProperty(value = "备注(notes)")
     @ApiModelProperty(value = "备注(notes)")
     private String notes;
     private String notes;
 	/**来源*/
 	/**来源*/
-	@Excel(name = "来源", width = 15)
-    @ApiModelProperty(value = "来源")
+	@Excel(name = "来源(发货单)", width = 15)
+    @ApiModelProperty(value = "来源(发货单)")
     private String sourceId;
     private String sourceId;
+	//来源批次id
+    private String batchId;
 }
 }

+ 9 - 1
srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/IStoreOnhandService.java

@@ -3,6 +3,8 @@ package org.jeecg.modules.storeCode.service;
 import org.jeecg.modules.storeCode.entity.StoreOnhand;
 import org.jeecg.modules.storeCode.entity.StoreOnhand;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
+import java.math.BigDecimal;
+
 /**
 /**
  * @Description: 现存量
  * @Description: 现存量
  * @Author: jeecg-boot
  * @Author: jeecg-boot
@@ -11,5 +13,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface IStoreOnhandService extends IService<StoreOnhand> {
 public interface IStoreOnhandService extends IService<StoreOnhand> {
 
 
-    public String addStore(StoreOnhand storeOnhand);
+    public String addStore(StoreOnhand storeOnhand,String sourceType);
+
+    public String deleteStore(StoreOnhand storeOnhand,String sourceType);
+
+    public String addStoreById(BigDecimal quantity,String id,  String sourceType, String sourceCode);
+
+    public String deleteStoreById(BigDecimal quantity,String id,  String sourceType, String sourceCode);
 }
 }

+ 16 - 0
srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/IStoreSaleOutService.java

@@ -49,6 +49,22 @@ public interface IStoreSaleOutService extends IService<StoreSaleOut> {
 	 */
 	 */
 	public void delBatchMain (Collection<? extends Serializable> idList);
 	public void delBatchMain (Collection<? extends Serializable> idList);
 
 
+	/**
+	 * 设置是否出口
+	 *
+	 * @param ids
+	 * @return
+	 */
+	public Result<String> setExport(String ids, String export);
+
+	/**
+	 * 开票申请
+	 *
+	 * @param ids
+	 * @return
+	 */
+	public Result<String> applyInvoice(String ids);
+
 	/**
 	/**
 	 * 批量提交
 	 * 批量提交
 	 *
 	 *

+ 78 - 18
srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StoreCheckServiceImpl.java

@@ -8,11 +8,13 @@ import org.jeecg.modules.storeCode.entity.StoreCheck;
 import org.jeecg.modules.storeCode.mapper.StoreCheckDetailsMapper;
 import org.jeecg.modules.storeCode.mapper.StoreCheckDetailsMapper;
 import org.jeecg.modules.storeCode.mapper.StoreCheckMapper;
 import org.jeecg.modules.storeCode.mapper.StoreCheckMapper;
 import org.jeecg.modules.storeCode.service.IStoreCheckService;
 import org.jeecg.modules.storeCode.service.IStoreCheckService;
+import org.jeecg.modules.storeCode.service.IStoreOnhandService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
@@ -31,7 +33,10 @@ public class StoreCheckServiceImpl extends ServiceImpl<StoreCheckMapper, StoreCh
 	private StoreCheckMapper storeCheckMapper;
 	private StoreCheckMapper storeCheckMapper;
 	@Autowired
 	@Autowired
 	private StoreCheckDetailsMapper storeCheckDetailsMapper;
 	private StoreCheckDetailsMapper storeCheckDetailsMapper;
-	
+
+	@Autowired
+	private IStoreOnhandService storeOnhandService;
+
 	@Override
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
 	public void saveMain(StoreCheck storeCheck, List<StoreCheckDetails> storeCheckDetailsList) {
 	public void saveMain(StoreCheck storeCheck, List<StoreCheckDetails> storeCheckDetailsList) {
@@ -39,6 +44,7 @@ public class StoreCheckServiceImpl extends ServiceImpl<StoreCheckMapper, StoreCh
 		if(storeCheckDetailsList!=null && storeCheckDetailsList.size()>0) {
 		if(storeCheckDetailsList!=null && storeCheckDetailsList.size()>0) {
 			for(StoreCheckDetails entity:storeCheckDetailsList) {
 			for(StoreCheckDetails entity:storeCheckDetailsList) {
 				//外键设置
 				//外键设置
+				entity.setId(null);
 				entity.setHeadId(storeCheck.getId());
 				entity.setHeadId(storeCheck.getId());
 				storeCheckDetailsMapper.insert(entity);
 				storeCheckDetailsMapper.insert(entity);
 			}
 			}
@@ -57,6 +63,7 @@ public class StoreCheckServiceImpl extends ServiceImpl<StoreCheckMapper, StoreCh
 		if(storeCheckDetailsList!=null && storeCheckDetailsList.size()>0) {
 		if(storeCheckDetailsList!=null && storeCheckDetailsList.size()>0) {
 			for(StoreCheckDetails entity:storeCheckDetailsList) {
 			for(StoreCheckDetails entity:storeCheckDetailsList) {
 				//外键设置
 				//外键设置
+				entity.setId(null);
 				entity.setHeadId(storeCheck.getId());
 				entity.setHeadId(storeCheck.getId());
 				storeCheckDetailsMapper.insert(entity);
 				storeCheckDetailsMapper.insert(entity);
 			}
 			}
@@ -109,8 +116,8 @@ public class StoreCheckServiceImpl extends ServiceImpl<StoreCheckMapper, StoreCh
 			return Result.error(sb.toString());
 			return Result.error(sb.toString());
 		}
 		}
 
 
-		//执行入库操作
-		String result = actionIn(list);
+		//执行入库操作
+		String result = actionIn(list,true);
 
 
 		if ("true".equals(result)) {
 		if ("true".equals(result)) {
 
 
@@ -155,32 +162,85 @@ public class StoreCheckServiceImpl extends ServiceImpl<StoreCheckMapper, StoreCh
 			}
 			}
 		}
 		}
 
 
-//		QueryWrapper<StoreOnhand> queryWrapper2 = new QueryWrapper<>();
-//		queryWrapper2.in("source_code", idList);
-//		queryWrapper2.last(" and quantity != initial_quantity ");
-//		List<StoreOnhand> listNum = storeOnhandService.list(queryWrapper2);
-//		if(listNum.size() > 0){
-//			return Result.error("单号" + listNum.get(0).getBatchCode()+"库存已被使用,无法取消提交;");
-//		}
-
 		if (StringUtils.isNotBlank(sb.toString())) {
 		if (StringUtils.isNotBlank(sb.toString())) {
 
 
 			return Result.error(sb.toString());
 			return Result.error(sb.toString());
 		}
 		}
 
 
-		StoreCheck ent = new StoreCheck();
-		ent.setSubmit("0");
-		this.update(ent, queryWrapper);
+		//执行出入库操作
+		String result = actionIn(list,false);
+
+		if ("true".equals(result)) {
+
+			StoreCheck ent = new StoreCheck();
+			ent.setSubmit("0");
+			this.update(ent, queryWrapper);
+		} else {
+
+			return Result.error(result);
+		}
 
 
 		return Result.OK("取消提交成功!");
 		return Result.OK("取消提交成功!");
 	}
 	}
 
 
 
 
-
-	//执行入库操作
+	//执行出库操作
+	//type true 提交盘盈盘亏 false 取消提交盘盈盘亏
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
-	public String actionIn(List<StoreCheck> list) {
-		
+	public String actionIn(List<StoreCheck> list,boolean type) {
+
+		try {
+
+			for (StoreCheck o : list) {
+
+				String id = o.getId();
+				String code = o.getBillCode();
+				List<StoreCheckDetails> entList = storeCheckDetailsMapper.selectByMainId(id);
+
+				for (StoreCheckDetails ent : entList) {
+
+					//库存id
+					String sourceId = ent.getSourceId();
+					//库存数量
+					BigDecimal inventoryQuantity = ent.getInventoryQuantity();
+					//盘点数量
+					BigDecimal countedQuantity = ent.getCountedQuantity();
+
+					BigDecimal inventory = countedQuantity.subtract(inventoryQuantity);
+
+					//提交
+					if (type) {
+
+						if(inventory.compareTo(BigDecimal.ZERO) > 0){
+
+							//增加库存 BigDecimal quantity,String id,  String sourceType, String sourceCode
+							storeOnhandService.addStoreById(inventory, sourceId, "盘盈盘亏(正数提交)", code);
+						}else if(inventory.compareTo(BigDecimal.ZERO) < 0){
+
+							//减少库存 BigDecimal quantity,String id,  String sourceType, String sourceCode
+							storeOnhandService.deleteStoreById(inventory.abs(), sourceId, "盘盈盘亏(负数提交)", code);
+						}
+
+						//取消提交
+					} else {
+
+						if(inventory.compareTo(BigDecimal.ZERO) > 0){
+
+							//减少库存 BigDecimal quantity,String id,  String sourceType, String sourceCode
+							storeOnhandService.deleteStoreById(inventory, sourceId, "盘盈盘亏(正数取消提交)", code);
+						}else if(inventory.compareTo(BigDecimal.ZERO) < 0){
+
+							//增加库存 BigDecimal quantity,String id,  String sourceType, String sourceCode
+							storeOnhandService.addStoreById(inventory.abs(), sourceId, "盘盈盘亏(负数取消提交)", code);
+						}
+
+					}
+				}
+			}
+
+		} catch (Exception e) {
+			return e.getMessage();
+		}
 		
 		
 		return "true";
 		return "true";
 	}
 	}

+ 144 - 12
srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StoreOnhandServiceImpl.java

@@ -1,18 +1,23 @@
 package org.jeecg.modules.storeCode.service.impl;
 package org.jeecg.modules.storeCode.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.gson.Gson;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.storeCode.entity.StoreOnhand;
 import org.jeecg.modules.storeCode.entity.StoreOnhand;
 import org.jeecg.modules.storeCode.mapper.StoreOnhandMapper;
 import org.jeecg.modules.storeCode.mapper.StoreOnhandMapper;
 import org.jeecg.modules.storeCode.service.IStoreOnhandService;
 import org.jeecg.modules.storeCode.service.IStoreOnhandService;
+import org.jeecg.modules.system.service.ISysDataLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -29,35 +34,162 @@ public class StoreOnhandServiceImpl extends ServiceImpl<StoreOnhandMapper, Store
     @Autowired
     @Autowired
     private ISerialPatternService serialPatternService;
     private ISerialPatternService serialPatternService;
 
 
+    @Resource
+    private ISysDataLogService sysDataLogService;
 
 
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public String addStore(StoreOnhand storeOnhand) {
+    public String addStoreById(BigDecimal quantity, String id, String sourceType, String sourceCode) {
 
 
-        String code = storeOnhand.getBatchCode();
-        if (StringUtils.isNotBlank(code)) {
+        try {
 
 
-            QueryWrapper<StoreOnhand> queryWrapper = new QueryWrapper();
-            queryWrapper.eq("batch_code", code);
-            queryWrapper.eq("del_flag", "0");
+            StoreOnhand storeOnhand = this.getById(id);
+            if (storeOnhand == null) {
+                throw new JeecgBootException(sourceType+sourceCode + "执行异常(数据不存在):"+id);
+            }
+
+            sysDataLogService.addDataLog(sourceType + "叠加库存", sourceCode+":"+id, quantity.toString());
+
+            BigDecimal quantityOld = storeOnhand.getQuantity();
+            BigDecimal newQuantity = quantity.add(quantityOld);
+
+            storeOnhand.setQuantity(newQuantity);
+            this.updateById(storeOnhand);
+
+            return "true";
+
+        } catch (Exception e) {
+            throw new JeecgBootException(sourceType +sourceCode+ "产品:" + id + "执行异常");
+        }
+
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String deleteStoreById(BigDecimal quantity, String id, String sourceType, String sourceCode) {
+
+        try {
+
+            StoreOnhand storeOnhand = this.getById(id);
+            if (storeOnhand == null) {
+                throw new JeecgBootException(sourceType +sourceCode+ "执行异常(数据不存在):"+id);
+            }
+
+            BigDecimal quantityOld = storeOnhand.getQuantity();
+
+            if (quantityOld.compareTo(quantity) < 0) {
+                throw new JeecgBootException(sourceType + sourceCode+ "产品:" + storeOnhand.getProductCode() + "库存不足,无法执行");
+            }
+            sysDataLogService.addDataLog(sourceType + "减少库存", sourceCode+":"+id, quantity.toString());
+
+            BigDecimal newQuantity = quantityOld.add(quantity);
+
+            storeOnhand.setQuantity(newQuantity);
+            this.updateById(storeOnhand);
+
+            return "true";
+
+        } catch (Exception e) {
+            throw new JeecgBootException(sourceType +sourceCode+ "产品:" + id + "执行异常");
+        }
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String addStore(StoreOnhand storeOnhand, String sourceType) {
+
+        String getSourceCode = storeOnhand.getSourceCode();
+        String getSourceId = storeOnhand.getSourceId();
+        String productCode = storeOnhand.getProductCode();
+
+        try {
 
 
+            QueryWrapper<StoreOnhand> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("project", storeOnhand.getProject());
+            queryWrapper.eq("product_id", storeOnhand.getProductId());
+            queryWrapper.eq("warehouse", storeOnhand.getWarehouse());
+            queryWrapper.eq("goods_allocation", storeOnhand.getGoodsAllocation());
             List<StoreOnhand> list = this.list(queryWrapper);
             List<StoreOnhand> list = this.list(queryWrapper);
-            if (list.size() != 0) {
-                return "现存量批次重复,请修改!";
+
+            Gson gson = new Gson();
+            String json = gson.toJson(storeOnhand);
+
+            if (list.size() > 0) {
+
+                sysDataLogService.addDataLog(sourceType + "(提交)" + getSourceCode, "叠加库存"+getSourceId, json);
+
+                StoreOnhand ent = list.get(0);
+                BigDecimal quantity = storeOnhand.getQuantity();
+                BigDecimal handQuantity = ent.getQuantity();
+                BigDecimal newQuantity = quantity.add(handQuantity);
+
+                ent.setQuantity(newQuantity);
+                this.updateById(ent);
+
+                return "true";
+
             }
             }
-        } else {
 
 
             Result<String> result = serialPatternService.getNextSerial("store_onhand", "batch_code");
             Result<String> result = serialPatternService.getNextSerial("store_onhand", "batch_code");
             if (!result.isSuccess()) {
             if (!result.isSuccess()) {
                 return result.getMessage();
                 return result.getMessage();
             }
             }
-
+            sysDataLogService.addDataLog(sourceType + "(提交)" + getSourceCode, "新增库存"+getSourceId, json);
             storeOnhand.setBatchCode(result.getMessage());
             storeOnhand.setBatchCode(result.getMessage());
-        }
 
 
-        storeOnhandMapper.insert(storeOnhand);
+            storeOnhandMapper.insert(storeOnhand);
 
 
+        } catch (Exception e) {
+            throw new JeecgBootException(getSourceCode + "产品:" + productCode + "执行异常");
+        }
         return "true";
         return "true";
     }
     }
 
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String deleteStore(StoreOnhand storeOnhand, String sourceType) {
+
+        String getSourceCode = storeOnhand.getSourceCode();
+        String getSourceId = storeOnhand.getSourceId();
+        String productCode = storeOnhand.getProductCode();
+
+        try {
+
+            QueryWrapper<StoreOnhand> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("project", storeOnhand.getProject());
+            queryWrapper.eq("product_id", storeOnhand.getProductId());
+            queryWrapper.eq("warehouse", storeOnhand.getWarehouse());
+            queryWrapper.eq("goods_allocation", storeOnhand.getGoodsAllocation());
+            List<StoreOnhand> list = this.list(queryWrapper);
+
+            Gson gson = new Gson();
+            String json = gson.toJson(storeOnhand);
+
+            if (list.size() > 0) {
+
+                StoreOnhand ent = list.get(0);
+                BigDecimal quantity = storeOnhand.getQuantity();
+                BigDecimal handQuantity = ent.getQuantity();
+                if (handQuantity.compareTo(quantity) < 0) {
+                    throw new JeecgBootException(getSourceCode + "产品:" + productCode + "库存不足,无法执行");
+                }
+
+                sysDataLogService.addDataLog(sourceType + "(取消提交)" + getSourceCode, "减少库存"+getSourceId, json);
+
+                BigDecimal newQuantity = handQuantity.subtract(quantity);
+                ent.setQuantity(newQuantity);
+                this.updateById(ent);
+
+                return "true";
+
+            } else {
+                throw new JeecgBootException(getSourceCode + "产品:" + productCode + "未找到有效库存");
+            }
+
+        } catch (Exception e) {
+            throw new JeecgBootException(getSourceCode + "产品:" + productCode + "执行异常");
+        }
+    }
+
 }
 }

+ 52 - 15
srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StoreOtherOutServiceImpl.java

@@ -5,14 +5,18 @@ import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.storeCode.entity.StoreOtherOut;
 import org.jeecg.modules.storeCode.entity.StoreOtherOut;
 import org.jeecg.modules.storeCode.entity.StoreOtherOutDetails;
 import org.jeecg.modules.storeCode.entity.StoreOtherOutDetails;
+import org.jeecg.modules.storeCode.entity.StoreSaleOut;
+import org.jeecg.modules.storeCode.entity.StoreSaleOutDetails;
 import org.jeecg.modules.storeCode.mapper.StoreOtherOutDetailsMapper;
 import org.jeecg.modules.storeCode.mapper.StoreOtherOutDetailsMapper;
 import org.jeecg.modules.storeCode.mapper.StoreOtherOutMapper;
 import org.jeecg.modules.storeCode.mapper.StoreOtherOutMapper;
+import org.jeecg.modules.storeCode.service.IStoreOnhandService;
 import org.jeecg.modules.storeCode.service.IStoreOtherOutService;
 import org.jeecg.modules.storeCode.service.IStoreOtherOutService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
@@ -31,6 +35,8 @@ public class StoreOtherOutServiceImpl extends ServiceImpl<StoreOtherOutMapper, S
 	private StoreOtherOutMapper storeOtherOutMapper;
 	private StoreOtherOutMapper storeOtherOutMapper;
 	@Autowired
 	@Autowired
 	private StoreOtherOutDetailsMapper storeOtherOutDetailsMapper;
 	private StoreOtherOutDetailsMapper storeOtherOutDetailsMapper;
+	@Autowired
+	private IStoreOnhandService storeOnhandService;
 	
 	
 	@Override
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
@@ -39,6 +45,7 @@ public class StoreOtherOutServiceImpl extends ServiceImpl<StoreOtherOutMapper, S
 		if(storeOtherOutDetailsList!=null && storeOtherOutDetailsList.size()>0) {
 		if(storeOtherOutDetailsList!=null && storeOtherOutDetailsList.size()>0) {
 			for(StoreOtherOutDetails entity:storeOtherOutDetailsList) {
 			for(StoreOtherOutDetails entity:storeOtherOutDetailsList) {
 				//外键设置
 				//外键设置
+				entity.setId(null);
 				entity.setHeadId(storeOtherOut.getId());
 				entity.setHeadId(storeOtherOut.getId());
 				storeOtherOutDetailsMapper.insert(entity);
 				storeOtherOutDetailsMapper.insert(entity);
 			}
 			}
@@ -57,6 +64,7 @@ public class StoreOtherOutServiceImpl extends ServiceImpl<StoreOtherOutMapper, S
 		if(storeOtherOutDetailsList!=null && storeOtherOutDetailsList.size()>0) {
 		if(storeOtherOutDetailsList!=null && storeOtherOutDetailsList.size()>0) {
 			for(StoreOtherOutDetails entity:storeOtherOutDetailsList) {
 			for(StoreOtherOutDetails entity:storeOtherOutDetailsList) {
 				//外键设置
 				//外键设置
+				entity.setId(null);
 				entity.setHeadId(storeOtherOut.getId());
 				entity.setHeadId(storeOtherOut.getId());
 				storeOtherOutDetailsMapper.insert(entity);
 				storeOtherOutDetailsMapper.insert(entity);
 			}
 			}
@@ -109,7 +117,7 @@ public class StoreOtherOutServiceImpl extends ServiceImpl<StoreOtherOutMapper, S
 		}
 		}
 
 
 		//执行出库操作
 		//执行出库操作
-		String result = actionIn(list);
+		String result = actionIn(list,false);
 
 
 		if ("true".equals(result)) {
 		if ("true".equals(result)) {
 
 
@@ -154,33 +162,62 @@ public class StoreOtherOutServiceImpl extends ServiceImpl<StoreOtherOutMapper, S
 			}
 			}
 		}
 		}
 
 
-//		QueryWrapper<StoreOnhand> queryWrapper2 = new QueryWrapper<>();
-//		queryWrapper2.in("source_code", idList);
-//		queryWrapper2.last(" and quantity != initial_quantity ");
-//		List<StoreOnhand> listNum = storeOnhandService.list(queryWrapper2);
-//		if(listNum.size() > 0){
-//			return Result.error("单号" + listNum.get(0).getBatchCode()+"库存已被使用,无法取消提交;");
-//		}
-
-		if (StringUtils.isNotBlank(sb.toString())) {
+ 		if (StringUtils.isNotBlank(sb.toString())) {
 
 
 			return Result.error(sb.toString());
 			return Result.error(sb.toString());
 		}
 		}
 
 
-		StoreOtherOut ent = new StoreOtherOut();
-		ent.setSubmit("0");
-		this.update(ent, queryWrapper);
+		//执行出库操作
+		String result = actionIn(list,true);
+
+		if ("true".equals(result)) {
+
+			StoreOtherOut ent = new StoreOtherOut();
+			ent.setSubmit("0");
+			this.update(ent, queryWrapper);
+		} else {
+
+			return Result.error(result);
+		}
 
 
 		return Result.OK("取消提交成功!");
 		return Result.OK("取消提交成功!");
 	}
 	}
 
 
 
 
-
 	//执行出库操作
 	//执行出库操作
+	//type false 减少库存  true 增加库存
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
-	public String actionIn(List<StoreOtherOut> list) {
+	public String actionIn(List<StoreOtherOut> list, boolean type) {
+
+
+		try {
+
+			for (StoreOtherOut o : list) {
 
 
+				String id = o.getId();
+				String code = o.getBillCode();
+				List<StoreOtherOutDetails> entList = storeOtherOutDetailsMapper.selectByMainId(id);
 
 
+				for (StoreOtherOutDetails ent : entList) {
+
+					//库存id
+					String sourceId = ent.getBatchId();
+					//出库数量
+					BigDecimal stockOutQuantity = ent.getStockOutQuantity();
+
+					if (type) {
+						//增加库存 BigDecimal quantity,String id,  String sourceType, String sourceCode
+						storeOnhandService.addStoreById(stockOutQuantity, sourceId, "其他出库(取消提交)", code);
+					} else {
+						//减少库存
+						storeOnhandService.deleteStoreById(stockOutQuantity, sourceId, "其他出库(提交)", code);
+					}
+				}
+			}
+
+		} catch (Exception e) {
+			return e.getMessage();
+		}
 		return "true";
 		return "true";
 	}
 	}
 
 

+ 41 - 20
srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StorePurchaseInServiceImpl.java

@@ -3,20 +3,19 @@ package org.jeecg.modules.storeCode.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.modules.storeCode.entity.StoreOnhand;
-import org.jeecg.modules.storeCode.entity.StorePurchaseIn;
-import org.jeecg.modules.storeCode.entity.StorePurchaseInShip;
-import org.jeecg.modules.storeCode.entity.StorePurchaseInDetails;
+import org.jeecg.modules.storeCode.entity.*;
 import org.jeecg.modules.storeCode.mapper.StorePurchaseInShipMapper;
 import org.jeecg.modules.storeCode.mapper.StorePurchaseInShipMapper;
 import org.jeecg.modules.storeCode.mapper.StorePurchaseInDetailsMapper;
 import org.jeecg.modules.storeCode.mapper.StorePurchaseInDetailsMapper;
 import org.jeecg.modules.storeCode.mapper.StorePurchaseInMapper;
 import org.jeecg.modules.storeCode.mapper.StorePurchaseInMapper;
 import org.jeecg.modules.storeCode.service.IStoreOnhandService;
 import org.jeecg.modules.storeCode.service.IStoreOnhandService;
 import org.jeecg.modules.storeCode.service.IStorePurchaseInService;
 import org.jeecg.modules.storeCode.service.IStorePurchaseInService;
+import org.jeecg.modules.system.service.ISysDataLogService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import javax.annotation.Resource;
 import java.io.Serializable;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -116,7 +115,7 @@ public class StorePurchaseInServiceImpl extends ServiceImpl<StorePurchaseInMappe
         }
         }
         storePurchaseIn.setType(isQualified);
         storePurchaseIn.setType(isQualified);
 //        if(isQualified.equals("2")){
 //        if(isQualified.equals("2")){
-            storePurchaseIn.setHasDeal("0");
+        storePurchaseIn.setHasDeal("0");
 //        }
 //        }
 
 
         storePurchaseInMapper.updateById(storePurchaseIn);
         storePurchaseInMapper.updateById(storePurchaseIn);
@@ -216,6 +215,18 @@ public class StorePurchaseInServiceImpl extends ServiceImpl<StorePurchaseInMappe
             // 1-已提交,0-未提交
             // 1-已提交,0-未提交
             String submit = o.getSubmit();
             String submit = o.getSubmit();
             String code = o.getBillCode();
             String code = o.getBillCode();
+            String getWarehouse = o.getWarehouse();
+            String getGoodsAllocation = o.getGoodsAllocation();
+
+            if (StringUtils.isBlank(getWarehouse)) {
+                sb.append("单据编码" + code).append("仓库为空,无法入库;");
+                continue;
+            }
+            if (StringUtils.isBlank(getGoodsAllocation)) {
+                sb.append("单据编码" + code).append("货位为空,无法入库;");
+                continue;
+            }
+
 //            //1已处理 0未处理
 //            //1已处理 0未处理
 //            String hasDeal = o.getHasDeal();
 //            String hasDeal = o.getHasDeal();
 //            //1采购入库 2异常采购入库
 //            //1采购入库 2异常采购入库
@@ -240,7 +251,7 @@ public class StorePurchaseInServiceImpl extends ServiceImpl<StorePurchaseInMappe
         }
         }
 
 
         //执行入库操作
         //执行入库操作
-        String result = actionIn(list);
+        String result = actionIn(list, true);
 
 
         if ("true".equals(result)) {
         if ("true".equals(result)) {
 
 
@@ -259,7 +270,7 @@ public class StorePurchaseInServiceImpl extends ServiceImpl<StorePurchaseInMappe
 
 
     //执行入库操作
     //执行入库操作
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public String actionIn(List<StorePurchaseIn> list) {
+    public String actionIn(List<StorePurchaseIn> list, boolean type) {
 
 
         try {
         try {
             for (StorePurchaseIn o : list) {
             for (StorePurchaseIn o : list) {
@@ -269,7 +280,7 @@ public class StorePurchaseInServiceImpl extends ServiceImpl<StorePurchaseInMappe
                 for (StorePurchaseInDetails ent : entList) {
                 for (StorePurchaseInDetails ent : entList) {
 
 
                     String qualified = ent.getQualified();//是否合格 1是 0否
                     String qualified = ent.getQualified();//是否合格 1是 0否
-                    if(StringUtils.isNotBlank(qualified) && qualified.equals("0")){
+                    if (StringUtils.isNotBlank(qualified) && qualified.equals("0")) {
                         continue;
                         continue;
                     }
                     }
 
 
@@ -283,6 +294,7 @@ public class StorePurchaseInServiceImpl extends ServiceImpl<StorePurchaseInMappe
                     storeOnhand.setSupplier(o.getSupplier());//供应商
                     storeOnhand.setSupplier(o.getSupplier());//供应商
                     storeOnhand.setSupplierName(o.getSupplierName());//供应商
                     storeOnhand.setSupplierName(o.getSupplierName());//供应商
                     storeOnhand.setProductionClass(o.getProductionClass());//产品分类
                     storeOnhand.setProductionClass(o.getProductionClass());//产品分类
+                    storeOnhand.setProductionClassName(ent.getProductClass());//产品分类
                     storeOnhand.setMaker(o.getMaker());//厂家
                     storeOnhand.setMaker(o.getMaker());//厂家
 
 
                     storeOnhand.setProductId(ent.getProductId());//产品
                     storeOnhand.setProductId(ent.getProductId());//产品
@@ -303,7 +315,14 @@ public class StorePurchaseInServiceImpl extends ServiceImpl<StorePurchaseInMappe
                     storeOnhand.setSourceCode(o.getBillCode());//记录来源code
                     storeOnhand.setSourceCode(o.getBillCode());//记录来源code
                     storeOnhand.setStoreDate(o.getBillDate());//记录来源单据入库日期
                     storeOnhand.setStoreDate(o.getBillDate());//记录来源单据入库日期
 
 
-                    storeOnhandService.addStore(storeOnhand);
+                    if (type) {
+
+                        //增加库存
+                        storeOnhandService.addStore(storeOnhand, "采购入库");
+                    } else {
+                        //减少库存
+                        storeOnhandService.deleteStore(storeOnhand, "采购入库");
+                    }
                 }
                 }
 
 
             }
             }
@@ -343,22 +362,24 @@ public class StorePurchaseInServiceImpl extends ServiceImpl<StorePurchaseInMappe
             }
             }
         }
         }
 
 
-        QueryWrapper<StoreOnhand> queryWrapper2 = new QueryWrapper<>();
-        queryWrapper2.in("source_code", idList);
-        queryWrapper2.last(" and quantity != initial_quantity ");
-        List<StoreOnhand> listNum = storeOnhandService.list(queryWrapper2);
-        if(listNum.size() > 0){
-            return Result.error("单号" + listNum.get(0).getBatchCode()+"库存已被使用,无法取消提交;");
-        }
-
         if (StringUtils.isNotBlank(sb.toString())) {
         if (StringUtils.isNotBlank(sb.toString())) {
 
 
             return Result.error(sb.toString());
             return Result.error(sb.toString());
         }
         }
 
 
-        StorePurchaseIn ent = new StorePurchaseIn();
-        ent.setSubmit("0");
-        this.update(ent, queryWrapper);
+        //执行入库操作
+        String result = actionIn(list, false);
+
+        if ("true".equals(result)) {
+
+            StorePurchaseIn ent = new StorePurchaseIn();
+            ent.setSubmit("0");
+            this.update(ent, queryWrapper);
+        } else {
+
+            return Result.error(result);
+        }
+
 
 
         return Result.OK("取消提交成功!");
         return Result.OK("取消提交成功!");
     }
     }

+ 243 - 227
srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StorePurchaseOtherServiceImpl.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
+
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
@@ -22,241 +23,256 @@ import java.util.Collection;
 /**
 /**
  * @Description: 其他入库单
  * @Description: 其他入库单
  * @Author: jeecg-boot
  * @Author: jeecg-boot
- * @Date:   2024-12-04
+ * @Date: 2024-12-04
  * @Version: V1.0
  * @Version: V1.0
  */
  */
 @Service
 @Service
 public class StorePurchaseOtherServiceImpl extends ServiceImpl<StorePurchaseOtherMapper, StorePurchaseOther> implements IStorePurchaseOtherService {
 public class StorePurchaseOtherServiceImpl extends ServiceImpl<StorePurchaseOtherMapper, StorePurchaseOther> implements IStorePurchaseOtherService {
 
 
-	@Autowired
-	private StorePurchaseOtherMapper storePurchaseOtherMapper;
-	@Autowired
-	private StorePurchaseOtherShipMapper storePurchaseOtherShipMapper;
-	@Autowired
-	private StorePurchaseOtherDetailsMapper storePurchaseOtherDetailsMapper;
-
-	@Autowired
-	private IStoreOnhandService storeOnhandService;
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void saveMain(StorePurchaseOther storePurchaseOther, List<StorePurchaseOtherShip> storePurchaseOtherShipList,List<StorePurchaseOtherDetails> storePurchaseOtherDetailsList) {
-		storePurchaseOtherMapper.insert(storePurchaseOther);
-		if(storePurchaseOtherShipList!=null && storePurchaseOtherShipList.size()>0) {
-			for(StorePurchaseOtherShip entity:storePurchaseOtherShipList) {
-				//外键设置
-				entity.setId(null);
-				entity.setHeadId(storePurchaseOther.getId());
-				storePurchaseOtherShipMapper.insert(entity);
-			}
-		}
-		if(storePurchaseOtherDetailsList!=null && storePurchaseOtherDetailsList.size()>0) {
-			for(StorePurchaseOtherDetails entity:storePurchaseOtherDetailsList) {
-				//外键设置
-				entity.setId(null);
-				entity.setHeadId(storePurchaseOther.getId());
-				storePurchaseOtherDetailsMapper.insert(entity);
-			}
-		}
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void updateMain(StorePurchaseOther storePurchaseOther,List<StorePurchaseOtherShip> storePurchaseOtherShipList,List<StorePurchaseOtherDetails> storePurchaseOtherDetailsList) {
-		storePurchaseOtherMapper.updateById(storePurchaseOther);
-		
-		//1.先删除子表数据
-		storePurchaseOtherShipMapper.deleteByMainId(storePurchaseOther.getId());
-		storePurchaseOtherDetailsMapper.deleteByMainId(storePurchaseOther.getId());
-		
-		//2.子表数据重新插入
-		if(storePurchaseOtherShipList!=null && storePurchaseOtherShipList.size()>0) {
-			for(StorePurchaseOtherShip entity:storePurchaseOtherShipList) {
-				//外键设置
-				entity.setId(null);
-				entity.setHeadId(storePurchaseOther.getId());
-				storePurchaseOtherShipMapper.insert(entity);
-			}
-		}
-		if(storePurchaseOtherDetailsList!=null && storePurchaseOtherDetailsList.size()>0) {
-			for(StorePurchaseOtherDetails entity:storePurchaseOtherDetailsList) {
-				//外键设置
-				entity.setId(null);
-				entity.setHeadId(storePurchaseOther.getId());
-				storePurchaseOtherDetailsMapper.insert(entity);
-			}
-		}
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void delMain(String id) {
-		storePurchaseOtherShipMapper.deleteByMainId(id);
-		storePurchaseOtherDetailsMapper.deleteByMainId(id);
-		storePurchaseOtherMapper.deleteById(id);
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void delBatchMain(Collection<? extends Serializable> idList) {
-		for(Serializable id:idList) {
-			storePurchaseOtherShipMapper.deleteByMainId(id.toString());
-			storePurchaseOtherDetailsMapper.deleteByMainId(id.toString());
-			storePurchaseOtherMapper.deleteById(id);
-		}
-	}
-
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Result<String> submitBatch(String ids) {
-
-		QueryWrapper<StorePurchaseOther> queryWrapper = new QueryWrapper<>();
-		queryWrapper.in("id", Arrays.asList(ids.split(",")));
-
-		List<StorePurchaseOther> list = this.list(queryWrapper);
-		if (list.size() == 0) {
-			return Result.error("数据为空!");
-		}
-
-		StringBuffer sb = new StringBuffer();
-		for (StorePurchaseOther o : list) {
-			// 1-已提交,0-未提交
-			String submit = o.getSubmit();
-			String code = o.getBillCode();
-
-			if (submit != null && submit != "" && submit.equals("1")) {
-				sb.append("单据编码" + code).append("已提交,请勿再次提交;");
-				continue;
-			}
-		}
-
-		if (StringUtils.isNotBlank(sb.toString())) {
-
-			return Result.error(sb.toString());
-		}
-
-		//执行入库操作
-		String result = actionIn(list);
-
-		if ("true".equals(result)) {
-
-			StorePurchaseOther ent = new StorePurchaseOther();
-			ent.setSubmit("1");
-			this.update(ent, queryWrapper);
-		} else {
-
-			return Result.error(result);
-		}
-
-
-		return Result.OK("提交成功!");
-
-	}
-
-
-	//执行入库操作
-	@Transactional(rollbackFor = Exception.class)
-	public String actionIn(List<StorePurchaseOther> list) {
-
-		try {
-
-			for (StorePurchaseOther o : list) {
-
-				List<StorePurchaseOtherDetails> entList = storePurchaseOtherDetailsMapper.selectByMainId(o.getId());
-
-				for (StorePurchaseOtherDetails ent : entList) {
-
-					StoreOnhand storeOnhand = new StoreOnhand();
-
-					storeOnhand.setWarehouse(o.getWarehouse());//仓库
-//                storeOnhand.setWarehouseName();//仓库名称
-					storeOnhand.setGoodsAllocation(o.getGoodsAllocation());//货位
-					storeOnhand.setProject(o.getProject());//项目
-					storeOnhand.setProjectName(o.getProjectName());//项目
-					storeOnhand.setSupplier(o.getSupplier());//供应商
-					storeOnhand.setSupplierName(o.getSupplierName());//供应商
-					storeOnhand.setProductionClass(o.getProductionClass());//产品分类
-					storeOnhand.setMaker(o.getMaker());//厂家
-
-					storeOnhand.setProductId(ent.getProductId());//产品
-					storeOnhand.setChineseName(ent.getChineseName());//产品
-					storeOnhand.setEnglishName(ent.getEnglishName());//产品
-					storeOnhand.setSpecifications(ent.getSpecifications());//规格
-					storeOnhand.setModel(ent.getModel());//型号
-					storeOnhand.setPartno(ent.getPartno());//备件号
-					storeOnhand.setDrawingno(ent.getDrawingno());//图号
-//                storeOnhand.setOrderno(ent.setOrderno());//
-					storeOnhand.setFactory(ent.getFactory());//厂家
-					storeOnhand.setQualityGrade(ent.getQualityGrade());//质量等级
-					storeOnhand.setQuantity(ent.getStockInQuantity());//入库数量
-					storeOnhand.setInitialQuantity(ent.getStockInQuantity());//初始数量
-					storeOnhand.setSourceId(ent.getId());//记录来源id
-					storeOnhand.setSourceCode(o.getBillCode());//记录来源code
-					storeOnhand.setStoreDate(o.getBillDate());//记录来源单据入库日期
-
-					storeOnhandService.addStore(storeOnhand);
-				}
-
-			}
-		} catch (Exception e) {
-			return e.getMessage();
-		}
-
-		return "true";
-	}
-
-
-
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Result<String> returnSubmitBatch(String ids) {
+    @Autowired
+    private StorePurchaseOtherMapper storePurchaseOtherMapper;
+    @Autowired
+    private StorePurchaseOtherShipMapper storePurchaseOtherShipMapper;
+    @Autowired
+    private StorePurchaseOtherDetailsMapper storePurchaseOtherDetailsMapper;
+
+    @Autowired
+    private IStoreOnhandService storeOnhandService;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void saveMain(StorePurchaseOther storePurchaseOther, List<StorePurchaseOtherShip> storePurchaseOtherShipList, List<StorePurchaseOtherDetails> storePurchaseOtherDetailsList) {
+        storePurchaseOtherMapper.insert(storePurchaseOther);
+        if (storePurchaseOtherShipList != null && storePurchaseOtherShipList.size() > 0) {
+            for (StorePurchaseOtherShip entity : storePurchaseOtherShipList) {
+                //外键设置
+                entity.setId(null);
+                entity.setHeadId(storePurchaseOther.getId());
+                storePurchaseOtherShipMapper.insert(entity);
+            }
+        }
+        if (storePurchaseOtherDetailsList != null && storePurchaseOtherDetailsList.size() > 0) {
+            for (StorePurchaseOtherDetails entity : storePurchaseOtherDetailsList) {
+                //外键设置
+                entity.setId(null);
+                entity.setHeadId(storePurchaseOther.getId());
+                storePurchaseOtherDetailsMapper.insert(entity);
+            }
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updateMain(StorePurchaseOther storePurchaseOther, List<StorePurchaseOtherShip> storePurchaseOtherShipList, List<StorePurchaseOtherDetails> storePurchaseOtherDetailsList) {
+        storePurchaseOtherMapper.updateById(storePurchaseOther);
+
+        //1.先删除子表数据
+        storePurchaseOtherShipMapper.deleteByMainId(storePurchaseOther.getId());
+        storePurchaseOtherDetailsMapper.deleteByMainId(storePurchaseOther.getId());
+
+        //2.子表数据重新插入
+        if (storePurchaseOtherShipList != null && storePurchaseOtherShipList.size() > 0) {
+            for (StorePurchaseOtherShip entity : storePurchaseOtherShipList) {
+                //外键设置
+                entity.setId(null);
+                entity.setHeadId(storePurchaseOther.getId());
+                storePurchaseOtherShipMapper.insert(entity);
+            }
+        }
+        if (storePurchaseOtherDetailsList != null && storePurchaseOtherDetailsList.size() > 0) {
+            for (StorePurchaseOtherDetails entity : storePurchaseOtherDetailsList) {
+                //外键设置
+                entity.setId(null);
+                entity.setHeadId(storePurchaseOther.getId());
+                storePurchaseOtherDetailsMapper.insert(entity);
+            }
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delMain(String id) {
+        storePurchaseOtherShipMapper.deleteByMainId(id);
+        storePurchaseOtherDetailsMapper.deleteByMainId(id);
+        storePurchaseOtherMapper.deleteById(id);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delBatchMain(Collection<? extends Serializable> idList) {
+        for (Serializable id : idList) {
+            storePurchaseOtherShipMapper.deleteByMainId(id.toString());
+            storePurchaseOtherDetailsMapper.deleteByMainId(id.toString());
+            storePurchaseOtherMapper.deleteById(id);
+        }
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> submitBatch(String ids) {
+
+        QueryWrapper<StorePurchaseOther> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", Arrays.asList(ids.split(",")));
+
+        List<StorePurchaseOther> list = this.list(queryWrapper);
+        if (list.size() == 0) {
+            return Result.error("数据为空!");
+        }
+
+        StringBuffer sb = new StringBuffer();
+        for (StorePurchaseOther o : list) {
+            // 1-已提交,0-未提交
+            String submit = o.getSubmit();
+            String code = o.getBillCode();
+
+            String getWarehouse = o.getWarehouse();
+            String getGoodsAllocation = o.getGoodsAllocation();
+
+            if (StringUtils.isBlank(getWarehouse)) {
+                sb.append("单据编码" + code).append("仓库为空,无法入库;");
+                continue;
+            }
+            if (StringUtils.isBlank(getGoodsAllocation)) {
+                sb.append("单据编码" + code).append("货位为空,无法入库;");
+                continue;
+            }
+            if (submit != null && submit != "" && submit.equals("1")) {
+                sb.append("单据编码" + code).append("已提交,请勿再次提交;");
+                continue;
+            }
+        }
+
+        if (StringUtils.isNotBlank(sb.toString())) {
+
+            return Result.error(sb.toString());
+        }
+
+        //执行入库操作
+        String result = actionIn(list,true);
+
+        if ("true".equals(result)) {
+
+            StorePurchaseOther ent = new StorePurchaseOther();
+            ent.setSubmit("1");
+            this.update(ent, queryWrapper);
+        } else {
+
+            return Result.error(result);
+        }
+
+
+        return Result.OK("提交成功!");
+
+    }
+
+
+    //执行入库操作
+    //type true增加库存  false减少库存
+    @Transactional(rollbackFor = Exception.class)
+    public String actionIn(List<StorePurchaseOther> list,boolean type) {
+
+        try {
+
+            for (StorePurchaseOther o : list) {
+
+                List<StorePurchaseOtherDetails> entList = storePurchaseOtherDetailsMapper.selectByMainId(o.getId());
 
 
-		QueryWrapper<StorePurchaseOther> queryWrapper = new QueryWrapper<>();
-		queryWrapper.in("id", Arrays.asList(ids.split(",")));
+                for (StorePurchaseOtherDetails ent : entList) {
 
 
-		List<StorePurchaseOther> list = this.list(queryWrapper);
-		if (list.size() == 0) {
-			return Result.error("数据为空!");
-		}
+                    StoreOnhand storeOnhand = new StoreOnhand();
 
 
-		StringBuffer sb = new StringBuffer();
-		List<String> idList = new ArrayList<>();
-		for (StorePurchaseOther o : list) {
-			//提交(1-是 ,0-否)
-			String submit = o.getSubmit();
-			String code = o.getBillCode();
-
-			if (submit == null || submit == "" || submit.equals("0")) {
-				sb.append("单号" + code).append("已取消提交,请勿再次取消提交;");
-				continue;
-			}
-		}
-
-		if (StringUtils.isNotBlank(sb.toString())) {
-
-			return Result.error(sb.toString());
-		}
-
-		QueryWrapper<StoreOnhand> queryWrapper2 = new QueryWrapper<>();
-		queryWrapper2.in("source_code", idList);
-		queryWrapper2.last(" and quantity != initial_quantity ");
-		List<StoreOnhand> listNum = storeOnhandService.list(queryWrapper2);
-		if(listNum.size() > 0){
-			return Result.error("单号" + listNum.get(0).getBatchCode()+"库存已被使用,无法取消提交;");
-		}
-
-		if (StringUtils.isNotBlank(sb.toString())) {
-
-			return Result.error(sb.toString());
-		}
-
-		StorePurchaseOther ent = new StorePurchaseOther();
-		ent.setSubmit("0");
-		this.update(ent, queryWrapper);
-
-		return Result.OK("取消提交成功!");
-	}
+                    storeOnhand.setWarehouse(o.getWarehouse());//仓库
+//                storeOnhand.setWarehouseName();//仓库名称
+                    storeOnhand.setGoodsAllocation(o.getGoodsAllocation());//货位
+                    storeOnhand.setProject(o.getProject());//项目
+                    storeOnhand.setProjectName(o.getProjectName());//项目
+                    storeOnhand.setSupplier(o.getSupplier());//供应商
+                    storeOnhand.setSupplierName(o.getSupplierName());//供应商
+                    storeOnhand.setProductionClass(o.getProductionClass());//产品分类
+                    storeOnhand.setProductionClassName(ent.getProductClass());//产品分类
+                    storeOnhand.setMaker(o.getMaker());//厂家
+
+                    storeOnhand.setProductId(ent.getProductId());//产品
+                    storeOnhand.setChineseName(ent.getChineseName());//产品
+                    storeOnhand.setEnglishName(ent.getEnglishName());//产品
+                    storeOnhand.setSpecifications(ent.getSpecifications());//规格
+                    storeOnhand.setModel(ent.getModel());//型号
+                    storeOnhand.setPartno(ent.getPartno());//备件号
+                    storeOnhand.setDrawingno(ent.getDrawingno());//图号
+//                storeOnhand.setOrderno(ent.setOrderno());//
+                    storeOnhand.setFactory(ent.getFactory());//厂家
+                    storeOnhand.setQualityGrade(ent.getQualityGrade());//质量等级
+                    storeOnhand.setQuantity(ent.getStockInQuantity());//入库数量
+                    storeOnhand.setInitialQuantity(ent.getStockInQuantity());//初始数量
+                    storeOnhand.setSourceId(ent.getId());//记录来源id
+                    storeOnhand.setSourceCode(o.getBillCode());//记录来源code
+                    storeOnhand.setStoreDate(o.getBillDate());//记录来源单据入库日期
+
+                    if(type){
+
+                        //增加库存
+                        storeOnhandService.addStore(storeOnhand, "其他入库");
+                    }else{
+                        //减少库存
+                        storeOnhandService.deleteStore(storeOnhand, "其他入库");
+                    }
+                }
+
+            }
+        } catch (Exception e) {
+            return e.getMessage();
+        }
+
+        return "true";
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> returnSubmitBatch(String ids) {
+
+        QueryWrapper<StorePurchaseOther> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", Arrays.asList(ids.split(",")));
+
+        List<StorePurchaseOther> list = this.list(queryWrapper);
+        if (list.size() == 0) {
+            return Result.error("数据为空!");
+        }
+
+        StringBuffer sb = new StringBuffer();
+        List<String> idList = new ArrayList<>();
+        for (StorePurchaseOther o : list) {
+            //提交(1-是 ,0-否)
+            String submit = o.getSubmit();
+            String code = o.getBillCode();
+
+            if (submit == null || submit == "" || submit.equals("0")) {
+                sb.append("单号" + code).append("已取消提交,请勿再次取消提交;");
+                continue;
+            }
+        }
+
+        if (StringUtils.isNotBlank(sb.toString())) {
+
+            return Result.error(sb.toString());
+        }
+
+        //执行入库操作
+        String result = actionIn(list,false);
+
+        if ("true".equals(result)) {
+
+            StorePurchaseOther ent = new StorePurchaseOther();
+            ent.setSubmit("0");
+            this.update(ent, queryWrapper);
+        } else {
+
+            return Result.error(result);
+        }
+
+        return Result.OK("取消提交成功!");
+    }
 
 
 
 
 }
 }

+ 235 - 166
srm-module-code/src/main/java/org/jeecg/modules/storeCode/service/impl/StoreSaleOutServiceImpl.java

@@ -9,12 +9,15 @@ import org.jeecg.modules.storeCode.entity.StoreSaleOutDetails;
 import org.jeecg.modules.storeCode.mapper.StoreSaleOutShipMapper;
 import org.jeecg.modules.storeCode.mapper.StoreSaleOutShipMapper;
 import org.jeecg.modules.storeCode.mapper.StoreSaleOutDetailsMapper;
 import org.jeecg.modules.storeCode.mapper.StoreSaleOutDetailsMapper;
 import org.jeecg.modules.storeCode.mapper.StoreSaleOutMapper;
 import org.jeecg.modules.storeCode.mapper.StoreSaleOutMapper;
+import org.jeecg.modules.storeCode.service.IStoreOnhandService;
 import org.jeecg.modules.storeCode.service.IStoreSaleOutService;
 import org.jeecg.modules.storeCode.service.IStoreSaleOutService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
+
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
@@ -23,185 +26,251 @@ import java.util.Collection;
 /**
 /**
  * @Description: 销售出库(sale out)
  * @Description: 销售出库(sale out)
  * @Author: jeecg-boot
  * @Author: jeecg-boot
- * @Date:   2024-12-11
+ * @Date: 2024-12-11
  * @Version: V1.0
  * @Version: V1.0
  */
  */
 @Service
 @Service
 public class StoreSaleOutServiceImpl extends ServiceImpl<StoreSaleOutMapper, StoreSaleOut> implements IStoreSaleOutService {
 public class StoreSaleOutServiceImpl extends ServiceImpl<StoreSaleOutMapper, StoreSaleOut> implements IStoreSaleOutService {
 
 
-	@Autowired
-	private StoreSaleOutMapper storeSaleOutMapper;
-	@Autowired
-	private StoreSaleOutShipMapper storeSaleOutShipMapper;
-	@Autowired
-	private StoreSaleOutDetailsMapper storeSaleOutDetailsMapper;
-	
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void saveMain(StoreSaleOut storeSaleOut, List<StoreSaleOutShip> storeSaleOutShipList,List<StoreSaleOutDetails> storeSaleOutDetailsList) {
-		storeSaleOutMapper.insert(storeSaleOut);
-		if(storeSaleOutShipList!=null && storeSaleOutShipList.size()>0) {
-			for(StoreSaleOutShip entity:storeSaleOutShipList) {
-				//外键设置
-				entity.setHeadId(storeSaleOut.getId());
-				storeSaleOutShipMapper.insert(entity);
-			}
-		}
-		if(storeSaleOutDetailsList!=null && storeSaleOutDetailsList.size()>0) {
-			for(StoreSaleOutDetails entity:storeSaleOutDetailsList) {
-				//外键设置
-				entity.setHeadId(storeSaleOut.getId());
-				storeSaleOutDetailsMapper.insert(entity);
-			}
-		}
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void updateMain(StoreSaleOut storeSaleOut,List<StoreSaleOutShip> storeSaleOutShipList,List<StoreSaleOutDetails> storeSaleOutDetailsList) {
-		storeSaleOutMapper.updateById(storeSaleOut);
-		
-		//1.先删除子表数据
-		storeSaleOutShipMapper.deleteByMainId(storeSaleOut.getId());
-		storeSaleOutDetailsMapper.deleteByMainId(storeSaleOut.getId());
-		
-		//2.子表数据重新插入
-		if(storeSaleOutShipList!=null && storeSaleOutShipList.size()>0) {
-			for(StoreSaleOutShip entity:storeSaleOutShipList) {
-				//外键设置
-				entity.setHeadId(storeSaleOut.getId());
-				storeSaleOutShipMapper.insert(entity);
-			}
-		}
-		if(storeSaleOutDetailsList!=null && storeSaleOutDetailsList.size()>0) {
-			for(StoreSaleOutDetails entity:storeSaleOutDetailsList) {
-				//外键设置
-				entity.setHeadId(storeSaleOut.getId());
-				storeSaleOutDetailsMapper.insert(entity);
-			}
-		}
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void delMain(String id) {
-		storeSaleOutShipMapper.deleteByMainId(id);
-		storeSaleOutDetailsMapper.deleteByMainId(id);
-		storeSaleOutMapper.deleteById(id);
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void delBatchMain(Collection<? extends Serializable> idList) {
-		for(Serializable id:idList) {
-			storeSaleOutShipMapper.deleteByMainId(id.toString());
-			storeSaleOutDetailsMapper.deleteByMainId(id.toString());
-			storeSaleOutMapper.deleteById(id);
-		}
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Result<String> submitBatch(String ids) {
-
-		QueryWrapper<StoreSaleOut> queryWrapper = new QueryWrapper<>();
-		queryWrapper.in("id", Arrays.asList(ids.split(",")));
-
-		List<StoreSaleOut> list = this.list(queryWrapper);
-		if (list.size() == 0) {
-			return Result.error("数据为空!");
-		}
-
-		StringBuffer sb = new StringBuffer();
-		for (StoreSaleOut o : list) {
-			// 1-已提交,0-未提交
-			String submit = o.getSubmit();
-			String code = o.getBillCode();
-
-			if (submit != null && submit != "" && submit.equals("1")) {
-				sb.append("单据编码" + code).append("已提交,请勿再次提交;");
-				continue;
-			}
-		}
-
-		if (StringUtils.isNotBlank(sb.toString())) {
-
-			return Result.error(sb.toString());
-		}
-
-		//执行入库操作
-		String result = actionIn(list);
-
-		if ("true".equals(result)) {
-
-			StoreSaleOut ent = new StoreSaleOut();
-			ent.setSubmit("1");
-			this.update(ent, queryWrapper);
-		} else {
-
-			return Result.error(result);
-		}
-
-		return Result.OK("提交成功!");
-
-	}
-
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Result<String> returnSubmitBatch(String ids) {
-
-		QueryWrapper<StoreSaleOut> queryWrapper = new QueryWrapper<>();
-		queryWrapper.in("id", Arrays.asList(ids.split(",")));
-
-		List<StoreSaleOut> list = this.list(queryWrapper);
-		if (list.size() == 0) {
-			return Result.error("数据为空!");
-		}
-
-		StringBuffer sb = new StringBuffer();
-		List<String> idList = new ArrayList<>();
-
-		for (StoreSaleOut o : list) {
-
-			//提交(1-是 ,0-否)
-			String submit = o.getSubmit();
-			String code = o.getBillCode();
-			idList.add(code);
-
-			if (submit == null || submit == "" || submit.equals("0")) {
-				sb.append("单号" + code).append("已取消提交,请勿再次取消提交;");
-				continue;
-			}
-		}
+    @Autowired
+    private StoreSaleOutMapper storeSaleOutMapper;
+    @Autowired
+    private StoreSaleOutShipMapper storeSaleOutShipMapper;
+    @Autowired
+    private StoreSaleOutDetailsMapper storeSaleOutDetailsMapper;
+    @Autowired
+    private IStoreOnhandService storeOnhandService;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void saveMain(StoreSaleOut storeSaleOut, List<StoreSaleOutShip> storeSaleOutShipList, List<StoreSaleOutDetails> storeSaleOutDetailsList) {
+        storeSaleOutMapper.insert(storeSaleOut);
+        if (storeSaleOutShipList != null && storeSaleOutShipList.size() > 0) {
+            for (StoreSaleOutShip entity : storeSaleOutShipList) {
+                //外键设置
+                entity.setId(null);
+                entity.setHeadId(storeSaleOut.getId());
+                storeSaleOutShipMapper.insert(entity);
+            }
+        }
+        if (storeSaleOutDetailsList != null && storeSaleOutDetailsList.size() > 0) {
+            for (StoreSaleOutDetails entity : storeSaleOutDetailsList) {
+                //外键设置
+                entity.setId(null);
+                entity.setHeadId(storeSaleOut.getId());
+                storeSaleOutDetailsMapper.insert(entity);
+            }
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updateMain(StoreSaleOut storeSaleOut, List<StoreSaleOutShip> storeSaleOutShipList, List<StoreSaleOutDetails> storeSaleOutDetailsList) {
+        storeSaleOutMapper.updateById(storeSaleOut);
+
+        //1.先删除子表数据
+        storeSaleOutShipMapper.deleteByMainId(storeSaleOut.getId());
+        storeSaleOutDetailsMapper.deleteByMainId(storeSaleOut.getId());
+
+        //2.子表数据重新插入
+        if (storeSaleOutShipList != null && storeSaleOutShipList.size() > 0) {
+            for (StoreSaleOutShip entity : storeSaleOutShipList) {
+                //外键设置
+                entity.setId(null);
+                entity.setHeadId(storeSaleOut.getId());
+                storeSaleOutShipMapper.insert(entity);
+            }
+        }
+        if (storeSaleOutDetailsList != null && storeSaleOutDetailsList.size() > 0) {
+            for (StoreSaleOutDetails entity : storeSaleOutDetailsList) {
+                //外键设置
+                entity.setId(null);
+                entity.setHeadId(storeSaleOut.getId());
+                storeSaleOutDetailsMapper.insert(entity);
+            }
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delMain(String id) {
+        storeSaleOutShipMapper.deleteByMainId(id);
+        storeSaleOutDetailsMapper.deleteByMainId(id);
+        storeSaleOutMapper.deleteById(id);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delBatchMain(Collection<? extends Serializable> idList) {
+        for (Serializable id : idList) {
+            storeSaleOutShipMapper.deleteByMainId(id.toString());
+            storeSaleOutDetailsMapper.deleteByMainId(id.toString());
+            storeSaleOutMapper.deleteById(id);
+        }
+    }
+
+    //是否出口(export)(1是 0否)
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> setExport(String ids, String export) {
+
+        QueryWrapper<StoreSaleOut> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", Arrays.asList(ids.split(",")));
+
+        StoreSaleOut ent = new StoreSaleOut();
+        ent.setIsExport(export);
+        this.update(ent, queryWrapper);
+
+        return Result.OK("执行成功!");
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> applyInvoice(String ids) {
+
+        QueryWrapper<StoreSaleOut> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", Arrays.asList(ids.split(",")));
+
+        StoreSaleOut ent = new StoreSaleOut();
+        ent.setApplyInvoice("1");
+        this.update(ent, queryWrapper);
+
+        return Result.OK("执行成功!");
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> submitBatch(String ids) {
+
+        QueryWrapper<StoreSaleOut> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", Arrays.asList(ids.split(",")));
+
+        List<StoreSaleOut> list = this.list(queryWrapper);
+        if (list.size() == 0) {
+            return Result.error("数据为空!");
+        }
+
+        StringBuffer sb = new StringBuffer();
+        for (StoreSaleOut o : list) {
+            // 1-已提交,0-未提交
+            String submit = o.getSubmit();
+            String code = o.getBillCode();
+
+            if (submit != null && submit != "" && submit.equals("1")) {
+                sb.append("单据编码" + code).append("已提交,请勿再次提交;");
+                continue;
+            }
+        }
+
+        if (StringUtils.isNotBlank(sb.toString())) {
+
+            return Result.error(sb.toString());
+        }
+
+        //执行出库操作
+        String result = actionIn(list, false);
+
+        if ("true".equals(result)) {
+
+            StoreSaleOut ent = new StoreSaleOut();
+            ent.setSubmit("1");
+            this.update(ent, queryWrapper);
+        } else {
+
+            return Result.error(result);
+        }
+
+        return Result.OK("提交成功!");
+
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> returnSubmitBatch(String ids) {
+
+        QueryWrapper<StoreSaleOut> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", Arrays.asList(ids.split(",")));
+
+        List<StoreSaleOut> list = this.list(queryWrapper);
+        if (list.size() == 0) {
+            return Result.error("数据为空!");
+        }
+
+        StringBuffer sb = new StringBuffer();
+
+        for (StoreSaleOut o : list) {
+
+            //提交(1-是 ,0-否)
+            String submit = o.getSubmit();
+            String code = o.getBillCode();
+
+            if (submit == null || submit == "" || submit.equals("0")) {
+                sb.append("单号" + code).append("已取消提交,请勿再次取消提交;");
+                continue;
+            }
+        }
+
+        if (StringUtils.isNotBlank(sb.toString())) {
+
+            return Result.error(sb.toString());
+        }
+
+        //执行出库操作
+        String result = actionIn(list, true);
+
+        if ("true".equals(result)) {
+
+            StoreSaleOut ent = new StoreSaleOut();
+            ent.setSubmit("0");
+            this.update(ent, queryWrapper);
+        } else {
+
+            return Result.error(result);
+        }
+
+        return Result.OK("取消提交成功!");
+    }
+
+
+    //执行出库操作
+    //type false 减少库存  true 增加库存
+    @Transactional(rollbackFor = Exception.class)
+    public String actionIn(List<StoreSaleOut> list, boolean type) {
+
+        try {
 
 
-//		QueryWrapper<StoreOnhand> queryWrapper2 = new QueryWrapper<>();
-//		queryWrapper2.in("source_code", idList);
-//		queryWrapper2.last(" and quantity != initial_quantity ");
-//		List<StoreOnhand> listNum = storeOnhandService.list(queryWrapper2);
-//		if(listNum.size() > 0){
-//			return Result.error("单号" + listNum.get(0).getBatchCode()+"库存已被使用,无法取消提交;");
-//		}
+            for (StoreSaleOut o : list) {
 
 
-		if (StringUtils.isNotBlank(sb.toString())) {
+                String id = o.getId();
+                String code = o.getBillCode();
+                List<StoreSaleOutDetails> entList = storeSaleOutDetailsMapper.selectByMainId(id);
 
 
-			return Result.error(sb.toString());
-		}
+                for (StoreSaleOutDetails ent : entList) {
 
 
-		StoreSaleOut ent = new StoreSaleOut();
-		ent.setSubmit("0");
-		this.update(ent, queryWrapper);
+                    //库存id
+                    String sourceId = ent.getBatchId();
+                    //出库数量
+                    BigDecimal stockOutQuantity = ent.getStockOutQuantity();
 
 
-		return Result.OK("取消提交成功!");
-	}
+                    if (type) {
+                        //增加库存 BigDecimal quantity,String id,  String sourceType, String sourceCode
+                        storeOnhandService.addStoreById(stockOutQuantity, sourceId, "销售出库(取消提交)", code);
+                    } else {
+                        //减少库存
+                        storeOnhandService.deleteStoreById(stockOutQuantity, sourceId, "销售出库(提交)", code);
+                    }
+                }
+            }
 
 
+        } catch (Exception e) {
+            return e.getMessage();
+        }
 
 
+        return "true";
+    }
 
 
-	//执行入库操作
-	@Transactional(rollbackFor = Exception.class)
-	public String actionIn(List<StoreSaleOut> list) {
 
 
 
 
-		return "true";
-	}
 }
 }

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/storeCode/vo/StoreSaleOutPage.java

@@ -125,6 +125,7 @@ public class StoreSaleOutPage {
 	private String productionClass;
 	private String productionClass;
 	private String model;
 	private String model;
 	private String maker;
 	private String maker;
+	private String sourceCode;
 	@ExcelCollection(name="销售出库子表 - 船明细")
 	@ExcelCollection(name="销售出库子表 - 船明细")
 	@ApiModelProperty(value = "销售出库子表 - 船明细")
 	@ApiModelProperty(value = "销售出库子表 - 船明细")
 	private List<StoreSaleOutShip> storeSaleOutShipList;
 	private List<StoreSaleOutShip> storeSaleOutShipList;