From 74a0ab2b608f21da1d96a9c5f4f0ee0e676a3e9a Mon Sep 17 00:00:00 2001
From: youjie <272855983@qq.com>
Date: Wed, 14 Dec 2022 11:16:45 +0800
Subject: [PATCH] 增加权限控制

---
 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue                                                                              |   2 +-
 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue                                                                         |  14 ++++++++++----
 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailEditModal.vue                                                            | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue                                                                |   1 -
 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentDetailEditModal.vue                                                          | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/warehouse/controller/WarehouseController.java                |   6 ++++++
 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java |   4 ++++
 7 files changed, 367 insertions(+), 6 deletions(-)
 create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailEditModal.vue
 create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentDetailEditModal.vue

diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue
index f6dfc41..e038bca 100644
--- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue
+++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue
@@ -234,7 +234,7 @@
           deleteBatch: "/config/warehouse/deleteBatch",
           exportXlsUrl: "/config/warehouse/exportXls",
           importExcelUrl: "config/warehouse/importExcel",
-          
+
         },
         dictOptions:{},
         superFieldList:[],
diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue
index 5ec8d81..70a334b 100644
--- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue
+++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue
@@ -62,7 +62,7 @@
         </template>
 
         <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">编辑</a>
+          <a @click="edit(record)">编辑</a>
           <a-divider type="vertical" />
           <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
             <a>删除</a>
@@ -73,6 +73,7 @@
     </div>
 
     <receiptDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></receiptDetail-modal>
+    <receipt-detail-edit-modal ref="modalEditForm" @ok="modalFormOk" :mainId="mainId"></receipt-detail-edit-modal>
   </a-card>
 </template>
 
@@ -80,11 +81,12 @@
 
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import ReceiptDetailModal from './modules/ReceiptDetailModal'
+  import ReceiptDetailEditModal from './modules/ReceiptDetailEditModal'
 
   export default {
     name: "ReceiptDetailList",
     mixins:[JeecgListMixin],
-    components: { ReceiptDetailModal },
+    components: { ReceiptDetailEditModal, ReceiptDetailModal },
     props:{
       mainId:{
         type:String,
@@ -215,8 +217,12 @@
         this.dataSource=[]
         this.selectedRowKeys=[]
         this.ipagination.current = 1
-      }
-
+      },
+      edit (record) {
+        this.$refs.modalEditForm.edit(record);
+        this.$refs.modalEditForm.title = "编辑";
+        this.$refs.modalEditForm.disableSubmit = false;
+      },
     }
   }
 </script>
diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailEditModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailEditModal.vue
new file mode 100644
index 0000000..a11d9b9
--- /dev/null
+++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailEditModal.vue
@@ -0,0 +1,183 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    switchFullscreen
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    <a-spin :spinning="confirmLoading">
+      <a-form-model ref="form" :model="model" :rules="validatorRules">
+        <a-row>
+          <a-col :span="24">
+            <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode">
+              <a-input v-model="model.materialCode"placeholder="请输入物料编码" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName">
+              <a-input v-model="model.materialName"placeholder="请输入物料名称" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="物料规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialSpec">
+              <a-input v-model="model.materialSpec"placeholder="请输入单据数量" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit">
+              <a-input v-model="model.materialUnit"placeholder="请输入物料单位" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="单据数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty">
+              <a-input-number v-model="model.qty"placeholder="请输入单据数量" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="已收数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskQty">
+              <a-input-number v-model="model.taskQty"placeholder="请输入已收数量" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus">
+              <j-dict-select-tag type="list" v-model="model.inventoryStatus" dictCode="inventory_status" placeholder="请选择库存状态" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch">
+              <a-input v-model="model.batch"placeholder="请输入批次" ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="单据状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
+              <j-dict-select-tag type="list" v-model="model.status" dictCode="receipt_status" placeholder="请选择单据状态" />
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </a-spin>
+  </j-modal>
+</template>
+
+<script>
+
+  import { httpAction } from '@/api/manage'
+  import { validateDuplicateValue } from '@/utils/util'
+  import {searchMaterialByCode} from '@/api/api'
+
+  export default {
+    name: "ReceiptDetailEditModal",
+    components: {
+    },
+    props:{
+      mainId:{
+        type:String,
+        required:false,
+        default:''
+      }
+    },
+    data () {
+      return {
+        title:"操作",
+        width:800,
+        visible: false,
+        materialList:{},
+        querySource:{},
+        model:{
+        },
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+        confirmLoading: false,
+        validatorRules: {
+           materialCode: [
+              { required: true, message: '请输入物料编码!'},
+           ],
+           qty: [
+              { required: true, message: '请输入单据数量!'},
+           ],
+           inventoryStatus: [
+              { required: true, message: '请输入库存状态!'},
+           ],
+        },
+        url: {
+          add: "/receipt/receiptHeader/addReceiptDetail",
+          edit: "/receipt/receiptHeader/editReceiptDetail",
+        }
+
+      }
+    },
+    created () {
+    //备份model原始值
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
+      this.searchMaterial();
+    },
+    methods: {
+      add () {
+        this.edit(this.modelDefault);
+        this.model.inventoryStatus =  "good";
+      },
+      edit (record) {
+        this.model = Object.assign({}, record);
+        this.visible = true;
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+        this.$refs.form.clearValidate();
+      },
+      searchMaterial() {
+        const that = this;
+        that.querySource.materialCode = that.model.materialCode;
+        searchMaterialByCode(that.querySource).then((res) => {
+          that.materialList = res.result;
+        })
+      },
+      handleOk () {
+        const that = this;
+        // 触发表单验证
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            this.model['receiptId'] = this.mainId
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.close();
+            })
+          }else{
+             return false
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue
index e6ed968..a662c54 100644
--- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue
+++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue
@@ -116,7 +116,6 @@
       searchMaterial() {
         const that = this;
         that.querySource.materialCode = that.model.materialCode;
-        console.log("model.materialCode:" + that.model.materialCode);
         searchMaterialByCode(that.querySource).then((res) => {
           that.materialList = res.result;
         })
diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentDetailEditModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentDetailEditModal.vue
new file mode 100644
index 0000000..cae713e
--- /dev/null
+++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentDetailEditModal.vue
@@ -0,0 +1,163 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    switchFullscreen
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    <a-spin :spinning="confirmLoading">
+      <a-form-model ref="form" :model="model" :rules="validatorRules">
+        <a-row>
+          <a-form-model-item label="物料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode">
+            <j-search-select-tag
+              v-model="model.materialCode"
+              :dictOptions="materialList"
+              :trigger-change="true"
+              placeholder="请选择物料编码"
+              @change="searchMaterial">
+            </j-search-select-tag>
+          </a-form-model-item>
+          <a-col :span="24">
+            <a-form-model-item label="单据数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty">
+              <a-input-number v-model="model.qty"placeholder="请输入单据数量" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus">
+              <j-dict-select-tag type="list" v-model="model.inventoryStatus" dictCode="inventory_status" placeholder="请选择库存状态" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch">
+              <a-input v-model="model.batch"placeholder="请输入批次" ></a-input>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </a-spin>
+  </j-modal>
+</template>
+
+<script>
+
+  import { httpAction } from '@/api/manage'
+  import { validateDuplicateValue } from '@/utils/util'
+  import {searchMaterialByCode} from '@/api/api'
+
+  export default {
+    name: "ShipmentDetailModal",
+    components: {
+    },
+    props:{
+      mainId:{
+        type:String,
+        required:false,
+        default:''
+      }
+    },
+    data () {
+      return {
+        title:"操作",
+        width:800,
+        visible: false,
+        materialList:{},
+        querySource:{},
+        model:{
+        },
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+
+        confirmLoading: false,
+        validatorRules: {
+          materialCode: [
+            { required: true, message: '请输入物料编码!'},
+          ],
+          qty: [
+            { required: true, message: '请输入单据数量!'},
+          ],
+          inventoryStatus: [
+            { required: true, message: '请输入库存状态!'},
+          ],
+        },
+        url: {
+          add: "/shipment/shipmentHeader/addShipmentDetail",
+          edit: "/shipment/shipmentHeader/editShipmentDetail",
+        }
+
+      }
+    },
+    created () {
+    //备份model原始值
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
+      this.searchMaterial();
+    },
+    methods: {
+      add () {
+        this.edit(this.modelDefault);
+        this.model.inventoryStatus =  "good";
+      },
+      edit (record) {
+        this.model = Object.assign({}, record);
+        this.visible = true;
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+        this.$refs.form.clearValidate();
+      },
+      handleOk () {
+        const that = this;
+        // 触发表单验证
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            this.model['shipmentId'] = this.mainId
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.close();
+            })
+          }else{
+             return false
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+      searchMaterial() {
+        const that = this;
+        that.querySource.materialCode = that.model.materialCode;
+        console.log("model.materialCode:" + that.model.materialCode);
+        searchMaterialByCode(that.querySource).then((res) => {
+          that.materialList = res.result;
+        })
+      },
+
+    }
+  }
+</script>
diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/warehouse/controller/WarehouseController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/warehouse/controller/WarehouseController.java
index 069c913..d72eda4 100644
--- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/warehouse/controller/WarehouseController.java
+++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/warehouse/controller/WarehouseController.java
@@ -9,6 +9,8 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
@@ -81,6 +83,7 @@ public class WarehouseController extends JeecgController<Warehouse, IWarehouseSe
 	@AutoLog(value = "仓库-添加")
 	@ApiOperation(value="仓库-添加", notes="仓库-添加")
 	@PostMapping(value = "/add")
+	@RequiresPermissions("warehouse:add")
 	public Result<String> add(@RequestBody Warehouse warehouse) {
 		warehouseService.save(warehouse);
 		return Result.OK("添加成功!");
@@ -95,6 +98,7 @@ public class WarehouseController extends JeecgController<Warehouse, IWarehouseSe
 	@AutoLog(value = "仓库-编辑")
 	@ApiOperation(value="仓库-编辑", notes="仓库-编辑")
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	@RequiresPermissions("warehouse:edit")
 	public Result<String> edit(@RequestBody Warehouse warehouse) {
 		warehouseService.updateById(warehouse);
 		return Result.OK("编辑成功!");
@@ -109,6 +113,7 @@ public class WarehouseController extends JeecgController<Warehouse, IWarehouseSe
 	@AutoLog(value = "仓库-通过id删除")
 	@ApiOperation(value="仓库-通过id删除", notes="仓库-通过id删除")
 	@DeleteMapping(value = "/delete")
+	@RequiresPermissions("warehouse:delete")
 	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
 		warehouseService.removeById(id);
 		return Result.OK("删除成功!");
@@ -123,6 +128,7 @@ public class WarehouseController extends JeecgController<Warehouse, IWarehouseSe
 	@AutoLog(value = "仓库-批量删除")
 	@ApiOperation(value="仓库-批量删除", notes="仓库-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
+	@RequiresPermissions("warehouse:delete")
 	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
 		this.warehouseService.removeByIds(Arrays.asList(ids.split(",")));
 		return Result.OK("批量删除成功!");
diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java
index b75099b..9194cbd 100644
--- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java
+++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java
@@ -51,10 +51,14 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper,
 		if(shipmentHeader == null) {
 			return Result.error("添加失败,没有找到出库单头");
 		}
+		if(shipmentHeader.getFirstStatus().intValue() != QuantityConstant.SHIPMENT_HEADER_BUILD) {
+			return Result.error("添加失败,出库单非创建状态不能新增详情");
+		}
 		String shipmentCode = shipmentHeader.getCode();
 		if(StringUtils.isEmpty(shipmentCode)) {
 			return Result.error("添加失败,没有找到出库单编码");
 		}
+
 		String warehouseCode = shipmentHeader.getWarehouseCode();
 		String companyCode = shipmentHeader.getCompanyCode();
 		String materialCode = shipmentDetail.getMaterialCode();
--
libgit2 0.22.2