Bladeren bron

添加仓库 出库入库 时间戳校验

阿伏兔 4 jaren geleden
bovenliggende
commit
dfc4db8a6e

+ 6 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TCorpsController.java

@@ -90,7 +90,9 @@ public class TCorpsController extends BaseController {
     @Log(title = "客户详情", businessType = BusinessType.INSERT)
     @PostMapping
     @RepeatSubmit
-    public AjaxResult add(@RequestParam("corps") String tCorps, @RequestParam("customerContacts") String tCustomerContacts) {
+    public AjaxResult add(@RequestParam("corps") String tCorps,
+                          @RequestParam("customerContacts") String tCustomerContacts,
+                          @RequestParam("attach") String attach) {
         // 检验编号、名称、简称 唯一
         TCorps tCorps1 = JSONArray.parseObject(tCorps, TCorps.class);
         if (UserConstants.NOT_UNIQUE.equals(tCorpsService.checkUFNoUnique(tCorps1))) {
@@ -107,7 +109,7 @@ public class TCorpsController extends BaseController {
                 return AjaxResult.error("未找到客户联系人信息,请确认");
             }
         }
-        return tCorpsService.insertTCorps(tCorps, tCustomerContacts, SecurityUtils.getLoginUser());
+        return tCorpsService.insertTCorps(tCorps, tCustomerContacts, attach, SecurityUtils.getLoginUser());
     }
 
     /**
@@ -117,8 +119,8 @@ public class TCorpsController extends BaseController {
     @Log(title = "客户详情", businessType = BusinessType.UPDATE)
     @PutMapping
     @RepeatSubmit
-    public AjaxResult edit(@RequestBody TCorps tCorps) {
-        return tCorpsService.updateTCorps(tCorps);
+    public AjaxResult edit(@RequestParam("corps") String tCorps, @RequestParam("attach") String attach) {
+        return tCorpsService.updateTCorps(tCorps, attach);
     }
 
     /**

+ 12 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TWarehouseInStockController.java

@@ -13,6 +13,7 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.domain.SysCheckCode;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.excel.InStock;
 import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
@@ -37,6 +38,17 @@ public class TWarehouseInStockController extends BaseController {
     private ITWarehouseBillsService itWarehouseBillsService;
 
     /**
+     * 查询单据是否允许修改
+     */
+    @GetMapping("/checkCode")
+    public boolean checkCode(SysCheckCode sysCheckCode) {
+        if (StringUtils.isNull(sysCheckCode.getfId())) {
+            return true;
+        }
+        return itWarehouseBillsService.checkCode(sysCheckCode);
+    }
+
+    /**
      * 查询入库详情主表列表
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:inStock:list')")

+ 14 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -305,4 +305,18 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         c.set(Calendar.DAY_OF_MONTH, lastDay);
         return format.format(c.getTime()) + " 23:59:59";
     }
+
+    /**
+     * 获取精确到毫秒的时间戳
+     * @param date  当前世界
+     * @return  结果
+     **/
+    public static Long getTimestamp(Date date)
+    {
+        if (null == date) {
+            return (long) 0;
+        }
+        String timestamp = String.valueOf(date.getTime());
+        return Long.valueOf(timestamp);
+    }
 }

+ 51 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCheckCode.java

@@ -0,0 +1,51 @@
+package com.ruoyi.system.domain;
+
+public class SysCheckCode {
+    /**
+     *  主表Id
+     */
+    private Long fId;
+
+    /**
+     *  业务类型
+     */
+    private String fType;
+
+    /**
+     *  编码
+     */
+    private String codeVal;
+
+    public Long getfId() {
+        return fId;
+    }
+
+    public void setfId(Long fId) {
+        this.fId = fId;
+    }
+
+    public String getfType() {
+        return fType;
+    }
+
+    public void setfType(String fType) {
+        this.fType = fType;
+    }
+
+    public String getCodeVal() {
+        return codeVal;
+    }
+
+    public void setCodeVal(String codeVal) {
+        this.codeVal = codeVal;
+    }
+
+    @Override
+    public String toString() {
+        return "SysCode{" +
+                "fId=" + fId +
+                ", fType='" + fType + '\'' +
+                ", codeVal='" + codeVal + '\'' +
+                '}';
+    }
+}

+ 13 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/domain/TCorps.java

@@ -224,6 +224,9 @@ public class TCorps extends BaseEntity {
     @Excel(name = "经营范围")
     private String manageScope;
 
+    /** 部门 */
+    private String deptId;
+
     public Long getfId() {
         return fId;
     }
@@ -632,11 +635,19 @@ public class TCorps extends BaseEntity {
         this.manageScope = manageScope;
     }
 
+    public String getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(String deptId) {
+        this.deptId = deptId;
+    }
+
     @Override
     public String toString() {
         return "TCorps{" +
                 "fId=" + fId +
-                ", fPid='" + fPid + '\'' +
+                ", fPid=" + fPid +
                 ", fTypeid='" + fTypeid + '\'' +
                 ", fNo='" + fNo + '\'' +
                 ", fName='" + fName + '\'' +
@@ -686,6 +697,7 @@ public class TCorps extends BaseEntity {
                 ", annualDate=" + annualDate +
                 ", registerdAddress='" + registerdAddress + '\'' +
                 ", manageScope='" + manageScope + '\'' +
+                ", deptId='" + deptId + '\'' +
                 '}';
     }
 }

+ 3 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java

@@ -37,7 +37,7 @@ public interface ITCorpsService {
      * @param tCorps 客户详情
      * @return 结果
      */
-    public AjaxResult insertTCorps(String tCorps, String tCustomerContacts, LoginUser loginUser);
+    public AjaxResult insertTCorps(String tCorps, String tCustomerContacts, String attach, LoginUser loginUser);
 
     /**
      * 修改客户详情
@@ -45,7 +45,7 @@ public interface ITCorpsService {
      * @param tCorps 客户详情
      * @return 结果
      */
-    public AjaxResult updateTCorps(TCorps tCorps);
+    public AjaxResult updateTCorps(String tCorps, String attach);
 
     /**
      * 批量删除客户详情
@@ -113,4 +113,5 @@ public interface ITCorpsService {
      * @return
      */
     public List<Map<String,Object>> getClientName(TCorps tCorps);
+
 }

+ 51 - 10
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java

@@ -21,7 +21,9 @@ import com.ruoyi.system.mapper.SysDeptMapper;
 import com.ruoyi.system.mapper.SysRoleMapper;
 import com.ruoyi.system.mapper.SysUserMapper;
 import com.ruoyi.system.mapper.SysUserRoleMapper;
+import com.ruoyi.warehouseBusiness.domain.TEnclosure;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.mapper.TEnclosureMapper;
 import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -54,6 +56,9 @@ public class TCorpsServiceImpl implements ITCorpsService {
     private SysUserRoleMapper userRoleMapper;
 
     @Autowired
+    private TEnclosureMapper tEnclosureMapper;
+
+    @Autowired
     private TCustomerContactMapper tCustomerContactMapper;
 
     @Autowired
@@ -70,16 +75,15 @@ public class TCorpsServiceImpl implements ITCorpsService {
     public Map<String, Object> selectTCorpsById(Long fId) {
         Map<String, Object> map = new HashMap<>();
         TCorps tCorps = tCorpsMapper.selectTCorpsById(fId);
-        if (StringUtils.isNotNull(tCorps)) {
-            map.put("corp", tCorps);
+        if (StringUtils.isNull(tCorps)) {
+            return AjaxResult.error("未找到信息");
         }
+        map.put("corp", tCorps);
        // List<TCustomerContact> customerContactList = tCustomerContactMapper.selectList(new EntityWrapper<TCustomerContact>().eq("f_pid", fId));
-        TCustomerContact tCustomerContact=  new TCustomerContact();
+        TCustomerContact tCustomerContact = new TCustomerContact();
         tCustomerContact.setfPid(fId);
-        List<TCustomerContact> customerContactList =tCustomerContactMapper.selectTCustomerContactList(tCustomerContact);
-        if (StringUtils.isNotEmpty(customerContactList)) {
-            map.put("customerContact", customerContactList);
-        }
+        map.put("customerContact", tCustomerContactMapper.selectTCustomerContactList(tCustomerContact));
+        map.put("attach", tEnclosureMapper.selectTEnclosureByPId(fId));
         return map;
     }
 
@@ -127,7 +131,7 @@ public class TCorpsServiceImpl implements ITCorpsService {
      */
     @Override
     @Transactional
-    public AjaxResult insertTCorps(String tCorps, String tCustomerContacts, LoginUser loginUser) {
+    public AjaxResult insertTCorps(String tCorps, String tCustomerContacts, String attach, LoginUser loginUser) {
         if (StringUtils.isEmpty(tCorps)) {
             return AjaxResult.error("提交失败:客户信息为空");
         }
@@ -153,6 +157,7 @@ public class TCorpsServiceImpl implements ITCorpsService {
                 }
             }
             tCorpsMapper.updateTCorps(corps);
+            tEnclosureMapper.deleteByFPid(fPid);
         }
         TCustomerContact tCustomerContact = new TCustomerContact();
         tCustomerContact.setfPid(corps.getfId());
@@ -250,17 +255,35 @@ public class TCorpsServiceImpl implements ITCorpsService {
                 tCustomerContactMapper.insertTCustomerContact(cc);
             }
         }
+        if (StringUtils.isNotEmpty(attach) && !"[]".equals(attach)) {
+            JSONArray jsonArray = JSONArray.parseArray(attach);
+            List<TEnclosure> tEnclosureList = JSONObject.parseArray(jsonArray.toJSONString(), TEnclosure.class);
+            int line = 1;
+            for (TEnclosure t : tEnclosureList) {
+                if (StringUtils.isEmpty(t.getfUrl())) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("附件表第" + line + "行数据未找到附件地址");
+                }
+                t.setfPid(fPid);
+                t.setCreateTime(new Date());
+                t.setCreateBy(loginUser.getUsername());
+                tEnclosureMapper.insertTEnclosure(t);
+                line++;
+            }
+        }
         return AjaxResult.success();
     }
 
     /**
      * 修改客户详情
      *
-     * @param tCorps 客户详情
+     * @param corps 客户详情
      * @return 结果
      */
     @Override
-    public AjaxResult updateTCorps(TCorps tCorps) {
+    @Transactional
+    public AjaxResult updateTCorps(String corps, String attach) {
+        TCorps tCorps = JSONArray.parseObject(corps, TCorps.class);
         TWarehouseBills tWarehouseBill =new TWarehouseBills();
         tWarehouseBill.setfCorpid(tCorps.getfId());
         List<TWarehouseBills>   tWarehouseBillList=tWarehouseBillsMapper.selectTWarehousebillsList(tWarehouseBill);
@@ -269,6 +292,23 @@ public class TCorpsServiceImpl implements ITCorpsService {
         }
         tCorps.setUpdateTime(DateUtils.getNowDate());
         tCorpsMapper.updateTCorps(tCorps);
+        tEnclosureMapper.deleteByFPid(tCorps.getfId());
+        if (StringUtils.isNotEmpty(attach) && !"[]".equals(attach)) {
+            JSONArray jsonArray = JSONArray.parseArray(attach);
+            List<TEnclosure> tEnclosureList = JSONObject.parseArray(jsonArray.toJSONString(), TEnclosure.class);
+            int line = 1;
+            for (TEnclosure t : tEnclosureList) {
+                if (StringUtils.isEmpty(t.getfUrl())) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("附件表第" + line + "行数据未找到附件地址");
+                }
+                t.setfPid(tCorps.getfId());
+                t.setCreateTime(new Date());
+                t.setCreateBy(SecurityUtils.getUsername());
+                tEnclosureMapper.insertTEnclosure(t);
+                line++;
+            }
+        }
         return AjaxResult.success();
     }
 
@@ -293,6 +333,7 @@ public class TCorpsServiceImpl implements ITCorpsService {
                 return AjaxResult.error("客户第" + i + "行仓库有货物不可删除");
             }
             tCorpsMapper.deleteTCorpsById(id);
+            tEnclosureMapper.deleteByFPid(id);
             i++;
         }
         return AjaxResult.success();

+ 8 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -3,6 +3,7 @@ package com.ruoyi.warehouseBusiness.service;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
+import com.ruoyi.system.domain.SysCheckCode;
 import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
@@ -426,4 +427,11 @@ public interface ITWarehouseBillsService {
      * @return
      */
     public AjaxResult withdrawOrdersById(Long fId);
+
+    /**
+     *  查询单据是否允许变更
+     * @param sysCheckCode
+     * @return  结果
+     */
+    public boolean checkCode(SysCheckCode sysCheckCode);
 }

+ 74 - 21
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -25,6 +25,7 @@ import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
+import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
 import com.ruoyi.shipping.domain.TCntr;
 import com.ruoyi.shipping.domain.TVoyage;
@@ -35,6 +36,7 @@ import com.ruoyi.shipping.mapper.TCntrMapper;
 import com.ruoyi.shipping.mapper.TVoyageMapper;
 import com.ruoyi.shipping.mapper.TWarehousebillsCntrMapper;
 import com.ruoyi.shipping.mapper.TWarehousebillsCntritemsMapper;
+import com.ruoyi.system.domain.SysCheckCode;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.SysConfigMapper;
 import com.ruoyi.system.mapper.SysDeptMapper;
@@ -509,6 +511,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         Long fPid = null;
         Map<String, Object> map = new HashMap<>();
         TWarehouseBills warehouseBills = JSONArray.parseObject(tWarehouseBills, TWarehouseBills.class);
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        warehouseBills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
         if (StringUtils.isNull(warehouseBills.getfId())) {
             // 如果是新数据
             warehouseBills.setfBillstatus(2L);
@@ -1034,6 +1038,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         }
         TWarehouseBills warehouseBills = JSONArray.parseObject(tWarehouseBills, TWarehouseBills.class);
         warehouseBills.setfItemsStatus(4L);
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        warehouseBills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
         if (StringUtils.isNull(warehouseBills.getfId())) {
             if (isApprove) {
                 warehouseBills.setfBillstatus(4L);
@@ -1753,6 +1759,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         } else {
             warehouseBills.setWarehouseStatus(6L);
         }
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        warehouseBills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
         // 仓库主表
         if (StringUtils.isNull(warehouseBills.getfId())) {
             return AjaxResult.error("请确认仓库信息是否保存");
@@ -1770,25 +1778,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         tWarehouseBillsMapper.updateTWarehousebills(warehouseBills);
         tWarehousebillsCntrMapper.deleteTWarehousebillsCntrfPid(fPid);
         // 仓储明细
-        if (StringUtils.isNotEmpty(tWarehousebillsitems) && "[]".equals(tWarehousebillsitems)) {
+        if (StringUtils.isNotEmpty(tWarehousebillsitems) && !"[]".equals(tWarehousebillsitems)) {
             JSONArray warehouseJSON = JSONArray.parseArray(tWarehousebillsitems);
             List<TWarehousebillsitems> warehousebillsitemsList = JSONObject.parseArray(warehouseJSON.toJSONString(), TWarehousebillsitems.class);
             int line = 0;
             for (TWarehousebillsitems wbItem : warehousebillsitemsList) {
                 line++;
                 if ("SJRK".equals(billsType) || "SJCK".equals(billsType) || "CKDB".equals(billsType) || "HWTG".equals(billsType)) {
-                    if (StringUtils.isNull(wbItem.getfChargedate())) {
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("库存明细第" + line + "行未找到仓储费计费日期,请确认");
-                    }
-                    if (StringUtils.isNull(wbItem.getfBillingway())) {
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("库存明细第" + line + "行未找到计费方式,请确认");
-                    }
-                    if (StringUtils.isNull(wbItem.getfOriginalbilldate())) {
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("库存明细第" + line + "行未找到原始入库日期,请确认");
-                    }
                     // 除了入库其他模块不需要更新主表的 仓储费计费日期到明细表,其他模块 应从库存总账把仓储费计费日期 赋给明细表
                     if ("SJRK".equals(billsType)) {
                         wbItem.setfMblno(warehouseBills.getfMblno());
@@ -1798,6 +1794,18 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                         wbItem.setfMblno(warehouseBills.getfMblno());// 入库更新库存前执行update更新明细的提单号等于主表的提单号
                     }
                 }
+                if (StringUtils.isNull(wbItem.getfChargedate())) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("库存明细第" + line + "行未找到仓储费计费日期,请确认");
+                }
+                if (StringUtils.isNull(wbItem.getfBillingway())) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("库存明细第" + line + "行未找到计费方式,请确认");
+                }
+                if (StringUtils.isNull(wbItem.getfOriginalbilldate())) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("库存明细第" + line + "行未找到原始入库日期,请确认");
+                }
                 wbItem.setfPid(fPid);
                 wbItem.setfBilltype(billsType);
                 wbItem.setCreateTime(new Date());
@@ -2786,6 +2794,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         tWarehouseBills.setfBilltype(billsType);
         tWarehouseBills.setUpdateBy(loginUser.getUser().getUserName());
         tWarehouseBills.setUpdateTime(new Date());
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        tWarehouseBills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
         tWarehouseBillsMapper.updateTWarehousebills(tWarehouseBills);
         tEnclosureMapper.deleteByFPid(tWarehouseBills.getfId());
         tWarehousebillsfeesMapper.deleteByFPid(tWarehouseBills.getfId());
@@ -2911,6 +2921,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 tWarehousebillsfeesMapper.insertTWarehousebillsfees(wbCr);
             }
         }
+        map.put("warehousebills", tWarehouseBills);
         map.put("warehousebillsitems", warehousebillsitemsList);
         return AjaxResult.success("成功", map);
     }
@@ -2932,6 +2943,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         Map<String, Object> map = new HashMap<>();
         TWarehouseBills tWarehouseBills = JSONArray.parseObject(warehouseBills, TWarehouseBills.class);
         tWarehouseBills.setfItemsStatus(4L);
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        tWarehouseBills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
         if (StringUtils.isNotNull(tWarehouseBills.getfId())) {
             tWarehouseBills.setUpdateBy(loginUser.getUser().getUserName());
             tWarehouseBills.setUpdateTime(new Date());
@@ -3198,11 +3211,11 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         } else if (status == 30) {
             tWarehouseBills.setfItemsStatus(3L);
         }
-        if (StringUtils.isNotNull(tWarehouseBills.getfId())) {
-            tWarehouseBills.setUpdateBy(loginUser.getUser().getUserName());
-            tWarehouseBills.setUpdateTime(new Date());
-            tWarehouseBillsMapper.updateTWarehousebills(tWarehouseBills);
-        }
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        tWarehouseBills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
+        tWarehouseBills.setUpdateBy(loginUser.getUser().getUserName());
+        tWarehouseBills.setUpdateTime(new Date());
+        tWarehouseBillsMapper.updateTWarehousebills(tWarehouseBills);
         tEnclosureMapper.deleteByFPid(tWarehouseBills.getfId());
         tWarehousebillsfeesMapper.deleteByFPid(tWarehouseBills.getfId());
         tWarehousebillsCntrMapper.deleteTWarehousebillsCntrfPid(tWarehouseBills.getfId());
@@ -3316,6 +3329,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         TWarehousebillsitems tWarehousebillsitems = new TWarehousebillsitems();
         tWarehousebillsitems.setfPid(tWarehouseBills.getfId());
         List<TWarehousebillsitems> mapList1 = tWarehousebillsitemsMapper.selectTWarehousebillsitemsList(tWarehousebillsitems);
+        map.put("fDateChanged", tWarehouseBills.getfDateChanged());
         map.put("warehousebillsitems", mapList);
         map.put("warehousebillsitems1", mapList1);
         return AjaxResult.success("成功", map);
@@ -3841,6 +3855,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         tWarehousebills.setUpdateTime(new Date());
         tWarehousebills.setfBillstatus(2L); //撤销状态
         tWarehousebills.setfReviewDate(null);// 审核通过时间清空
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        tWarehousebills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
         tWarehouseBillsMapper.updateTWarehousebills(tWarehousebills);
         tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(tWarehousebills.getfId(), 2L, new Date());
         if ("JSCCF".equals(tWarehousebills.getfBilltype())) {
@@ -3872,7 +3888,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 }
             }
         }
-        return AjaxResult.success();
+        return AjaxResult.success(tWarehousebills.getfDateChanged());
     }
 
     /**
@@ -3891,8 +3907,41 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         tWarehousebills.setUpdateTime(new Date());
         tWarehousebills.setWarehouseStatus(2L); //撤销状态
         tWarehousebills.setUpdateBy(SecurityUtils.getUsername());
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        tWarehousebills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
         tWarehouseBillsMapper.updateTWarehousebills(tWarehousebills);
-        return AjaxResult.success();
+        return AjaxResult.success(tWarehousebills.getfDateChanged());
+    }
+
+    /**
+     *  查询单据是否允许变更
+     * @param sysCheckCode
+     * @return  结果
+     */
+    @Override
+    public boolean checkCode(SysCheckCode sysCheckCode) {
+            switch (sysCheckCode.getfType()) {
+            case "warehouse" :
+                // 查询仓储业务
+                TWarehouseBills warehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(sysCheckCode.getfId());
+                if (StringUtils.isNotNull(sysCheckCode.getfId()) && StringUtils.isEmpty(warehouseBills.getfDateChanged())) {
+                    Long timestamp = DateUtils.getTimestamp(new Date());
+                    warehouseBills.setUpdateTime(new Date());
+                    warehouseBills.setUpdateBy(SecurityUtils.getUsername());
+                    warehouseBills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
+                    tWarehouseBillsMapper.updateTWarehousebills(warehouseBills);
+                    return true;
+                }
+                if (StringUtils.isEmpty(sysCheckCode.getCodeVal()) && StringUtils.isNotEmpty(warehouseBills.getfDateChanged())) {
+                    return false;
+                }
+                // 是否符合数据库编码
+                if (sysCheckCode.getCodeVal().equals(warehouseBills.getfDateChanged())) {
+                    return true;
+                }
+                break;
+        }
+        return false;
     }
 
     /**
@@ -3916,6 +3965,10 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         }
         TWarehouseBills tWarehousebills = JSONArray.parseObject(warehouseBills, TWarehouseBills.class);
         tWarehousebills.setfItemsStatus(1L); //撤销状态
+        tWarehousebills.setUpdateTime(new Date());
+        tWarehousebills.setUpdateBy(loginUser.getUsername());
+        Long timestamp = DateUtils.getTimestamp(new Date());
+        tWarehousebills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
         tWarehouseBillsMapper.updateTWarehousebills(tWarehousebills);
         tEnclosureMapper.deleteByFPid(tWarehousebills.getfId());
         tWarehousebillsfeesMapper.deleteByFPid(tWarehousebills.getfId());
@@ -4106,7 +4159,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 tWarehousebillsfeesMapper.insertTWarehousebillsfees(wbCr);
             }
         }
-        return AjaxResult.success();
+        return AjaxResult.success(tWarehousebills.getfDateChanged());
     }
 
 

+ 10 - 1
ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml

@@ -61,10 +61,16 @@
         <result property="annualDate"    column="annual_date"    />
         <result property="registerdAddress"    column="registerd_address"    />
         <result property="manageScope"    column="manage_scope"    />
+        <result property="deptId"    column="dept_id"    />
     </resultMap>
 
     <sql id="selectTCorpsVo">
-        select f_id, f_pid, f_typeid, f_no, f_name, f_cname, f_ename, f_tel, f_fax, f_email, f_manage, f_addr, f_eaddr, f_scale, f_province, f_city, f_stltypeid, f_stldays, f_contractno, f_contractb, f_contracte, f_tax, f_invtel, f_invaddr, f_bankno, f_bankname, f_ubankno, f_ubankname, f_status, del_flag, create_by, create_time, update_by, update_time, remark, f_typename, login_account, credit_lv, payment_days, car_num, head_office, registerd_capital, legal_person, insdustry, credit_num, taxpayer_num, industry_commerce_num, organization_num, register_organization, date_of_establishment, company_type, business_deadline, business_area, annual_date, registerd_address, manage_scope from t_corps
+        select f_id, f_pid, f_typeid, f_no, f_name, f_cname, f_ename, f_tel, f_fax, f_email, f_manage, f_addr, f_eaddr, f_scale, f_province,
+         f_city, f_stltypeid, f_stldays, f_contractno, f_contractb, f_contracte, f_tax, f_invtel, f_invaddr, f_bankno, f_bankname, f_ubankno,
+          f_ubankname, f_status, del_flag, create_by, create_time, update_by, update_time, remark, f_typename, login_account, credit_lv,
+           payment_days, car_num, head_office, registerd_capital, legal_person, insdustry, credit_num, taxpayer_num, industry_commerce_num,
+            organization_num, register_organization, date_of_establishment, company_type, business_deadline, business_area, annual_date,
+             registerd_address, manage_scope, dept_id from t_corps
     </sql>
 
     <select id="selectTCorpsList" parameterType="TCorps" resultMap="TCorpsResult">
@@ -268,6 +274,7 @@
             <if test="annualDate != null">annual_date,</if>
             <if test="registerdAddress != null">registerd_address,</if>
             <if test="manageScope != null">manage_scope,</if>
+            <if test="deptId != null">dept_id,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fPid != null and fPid != ''">#{fPid},</if>
@@ -325,6 +332,7 @@
             <if test="annualDate != null">#{annualDate},</if>
             <if test="registerdAddress != null">#{registerdAddress},</if>
             <if test="manageScope != null">#{manageScope},</if>
+            <if test="deptId != null">#{deptId},</if>
         </trim>
     </insert>
 
@@ -366,6 +374,7 @@
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="fTypename != null">f_typename = #{fTypename},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
         </trim>
         where f_id = #{fId}
     </update>