Browse Source

aps-领料不可以领其他工厂的在制品

sucheng 4 months ago
parent
commit
8cfb3f062b

+ 15 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsCustomerManagementDao.java

@@ -0,0 +1,15 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.ApsCustomerManagementDo;
+
+/**
+ * @Entity generator.domain.ApsCustomerManagement
+ */
+public interface ApsCustomerManagementDao extends BaseMapper<ApsCustomerManagementDo> {
+
+}
+
+
+
+

+ 11 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsCustomerManagementService.java

@@ -0,0 +1,11 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.rongwei.bsentity.domain.ApsCustomerManagementDo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ */
+public interface ApsCustomerManagementService extends IService<ApsCustomerManagementDo> {
+
+}

+ 40 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java

@@ -134,6 +134,8 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     private ApsScheduleLogService apsScheduleLogService;
     @Autowired
     private RedissonClient redissonClient;
+    @Autowired
+    private ApsCustomerManagementService apsCustomerManagementService;
 
 
     @Override
@@ -4043,6 +4045,8 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
 //        if (ObjectUtil.isEmpty(req.getBatchNumbers())) {
 //            return R.error("批次号不可为空");
 //        }
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         if (ObjectUtil.isEmpty(req.getBlankId())) {
             return R.error("坯料计划ID为空");
         }
@@ -4191,6 +4195,42 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                     return R.error("批次号" + s + "错误,该料卷在加工中");
                 }
 
+                //如果(在制品状态=备料中或待加工,并且在制品对应订单不是本工厂),
+                // 或者(在制品状态=待入库或已入库或已出库,
+                // 并且在制品对应订单的(订单类型不是内部订单或者客户所属工厂不是本工厂)),
+                // 错误提示:该料卷不是本工厂在制品
+                if (Arrays.asList("备料中", "待加工").contains(apsWorkInProgressInventoryDo.getWorkinprocessstatus())
+                        && !apsWorkInProgressInventoryDo.getTenantid().equals(tenantId)) {
+                    log.error("批次号备料中或待加工,不是本工厂");
+                    return R.error("批次号" + s + "不是本工厂在制品");
+                }
+                if (Arrays.asList("待入库", "已入库", "已出库").contains(apsWorkInProgressInventoryDo.getWorkinprocessstatus())) {
+                    //客户所属工厂
+                    String custonTenantId = "";
+                    //订单号
+                    String ordernumber = apsWorkInProgressInventoryDo.getOrdernumber();
+                    if (ObjectUtil.isNotEmpty(ordernumber)) {
+                        //根据订单号查询订单信息
+                        ApsProductionOrderDo apsProductionOrderDo = apsProductionOrderService.getOne(new LambdaQueryWrapper<ApsProductionOrderDo>().eq(ApsProductionOrderDo::getOrderno, ordernumber));
+                        //客户ID
+                        String customid = apsProductionOrderDo.getCustomid();
+                        if (ObjectUtil.isNotEmpty(customid)) {
+                            //查询客户信息
+                            ApsCustomerManagementDo apsCustomerManagementDo = apsCustomerManagementService.getById(customid);
+                            if (ObjectUtil.isNotEmpty(apsCustomerManagementDo)) {
+                                if (ObjectUtil.isNotEmpty(apsCustomerManagementDo.getManufactroy())) {
+                                    custonTenantId = apsCustomerManagementDo.getManufactroy();
+                                }
+                            }
+                        }
+                    }
+                    if (!apsWorkInProgressInventoryDo.getOrdertype().equals("内部订单")
+                            || !custonTenantId.equals(tenantId)) {
+                        log.error("批次号待入库或已入库或已出库,不是本工厂");
+                        return R.error("批次号" + s + "不是本工厂在制品");
+                    }
+                }
+
                 //如果在制品状态=待入库或已入库或已出库,并且在制品的订单号对应订单的订单类型=客户订单,错误提示:批次号{批次号}错误,该料卷是其他客户订单的成品
                 if (Arrays.asList("待入库", "已入库", "已出库").contains(apsWorkInProgressInventoryDo.getWorkinprocessstatus())) {
                     if (ObjectUtil.isNotEmpty(apsWorkInProgressInventoryDo.getOrdertype()) && apsWorkInProgressInventoryDo.getOrdertype().equals("客户订单")) {

+ 20 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsCustomerManagementServiceImpl.java

@@ -0,0 +1,20 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.ApsCustomerManagementDao;
+import com.rongwei.bscommon.sys.service.ApsCustomerManagementService;
+import com.rongwei.bsentity.domain.ApsCustomerManagementDo;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ */
+@Service
+public class ApsCustomerManagementServiceImpl extends ServiceImpl<ApsCustomerManagementDao, ApsCustomerManagementDo>
+    implements ApsCustomerManagementService {
+
+}
+
+
+
+

+ 43 - 41
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsCustomerManagementDo.java

@@ -1,6 +1,7 @@
 package com.rongwei.bsentity.domain;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
@@ -18,98 +19,99 @@ public class ApsCustomerManagementDo extends BaseDo implements Serializable {
     /**
      * 主键ID
      */
+    @TableId(value = "ID")
     private String id;
 
     /**
      *
      */
+    @TableField(value = "TENANTID")
     private String tenantid;
 
     /**
      * 扩展json格式配置
      */
+    @TableField(value = "ROPTION")
     private String roption;
 
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人
-     */
-    private String createusername;
-
-    /**
-     * 修改人
-     */
-    private String modifyusername;
-
     /**
      * 客户编号
      */
+    @TableField(value = "CUSTOMERUNIT")
     private String customerunit;
 
     /**
      * 客户名称
      */
+    @TableField(value = "CUSTOMERNAME")
     private String customername;
 
     /**
      * 客户简称
      */
+    @TableField(value = "CUSTOMERABBREVIATION")
     private String customerabbreviation;
 
     /**
-     * 送货地址
+     * 公司地址
      */
+    @TableField(value = "DELIVERYADDRESS")
     private String deliveryaddress;
 
     /**
      * 送货时长
      */
+    @TableField(value = "DELIVERYTIME")
     private Integer deliverytime;
 
     /**
      * 联系人
      */
+    @TableField(value = "CONTACTS")
     private String contacts;
 
     /**
      * 联系电话
      */
+    @TableField(value = "CONTACTSMOBILE")
     private String contactsmobile;
 
     /**
      * 仓库ID
      */
+    @TableField(value = "STOREID")
     private String storeid;
 
+    /**
+     * 统一信用社会代码
+     */
+    @TableField(value = "SOCIALCODE")
+    private String socialcode;
+
+    /**
+     * 邮箱
+     */
+    @TableField(value = "EMAIL")
+    private String email;
+
+    /**
+     * 客户类型
+     */
+    @TableField(value = "CUSTOMERTYPE")
+    private String customertype;
+
+    /**
+     * 是否已删除
+     */
+    @TableField(value = "ISDELETED")
+    private String isdeleted;
+
+    /**
+     * 客户工厂
+     */
+    @TableField(value = "MANUFACTROY")
+    private String manufactroy;
+
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 }