ly преди 2 години
родител
ревизия
3bee92e1ee

+ 7 - 2
master/src/main/java/com/ruoyi/project/ehs/controller/TJobticketController.java

@@ -136,10 +136,16 @@ public class TJobticketController extends BaseController {
     @Log(title = "工作票", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TJobticket tJobticket) {
+        if (tJobticket.getXpxp()!=null && tJobticket.getXpxp().equals("12")) {
+            int i = tJobticketMapper.countXp(tJobticket);
+            logger.info("预约票数量:" + i);
+            if (i >= 15) {
+                return AjaxResult.error("超过预约票数量上限15");
+            }
+        }
         ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
         StringBuilder contentUserUnit = new StringBuilder();
         List<SysDictData> book_user_unit = iSysDictTypeService.selectDictDataByType("book_user_unit");
-
         if (tJobticket.getUserUnit() != null) {
             for (SysDictData p : book_user_unit) {
                 if (tJobticket.getUserUnit().toString().equals(p.getDictValue())) {
@@ -151,7 +157,6 @@ public class TJobticketController extends BaseController {
         if (tJobticket.getUserMg() != null) {
             SysUser sysUser = sysUserService.selectUserById(tJobticket.getUserMg());
             contentUserUnit.append(sysUser.getNickName());
-
         }
         tJobticket.setByclxr(contentUserUnit.toString());
         tJobticket.setCreaterCode(getUserId().toString());

+ 2 - 0
master/src/main/java/com/ruoyi/project/ehs/mapper/TJobticketMapper.java

@@ -79,4 +79,6 @@ public interface TJobticketMapper
      * @return 结果
      */
     int selectTJobticketSameData(TJobticket tJobticket);
+
+    int countXp(TJobticket tJobticket);
 }

+ 33 - 0
master/src/main/java/com/ruoyi/project/invoice/controller/TApproveReserveInvoiceController.java

@@ -131,6 +131,39 @@ public class TApproveReserveInvoiceController extends BaseController {
             applyUser = invoice.getCreaterCode().toString();
 //            invoice.setStatus(0L);
 //            workService.updateById(invoice);
+//            switch (invoice.getWorkArea()) {
+//                case "310裂解区":
+//                case "700开关锅炉":
+//                case "320裂解区":
+//                case "250管廊-700":
+//                    devSupId = "20253,20257";
+//                    break;
+//                case "330压缩区":
+//                case "废水处理":
+//                case "600废碱":
+//                case "250管廊-600":
+//                    devSupId = "20249,20317";
+//                    break;
+//                case "380分离区":
+//                case "360分离区":
+//                case "350分离区":
+//                case "340分离区":
+//                    devSupId = "20252";
+//                    break;
+//                case "400汽油加氢":
+//                case "250管廊-400":
+//                    devSupId = "20248";
+//                    break;
+//                case "500芳烃抽提":
+//                case "250管廊-500":
+//                    devSupId = "20244";
+//                    break;
+//                case "D301控制楼":
+//                case " D201变电所":
+//                case " 维修厂房":
+//                case "危废车库":
+//                    devSupId = "20332,20250,20276";
+//                    break;
             TInvoiceDevice device = new TInvoiceDevice();
             device.setWorkArea(invoice.getWorkArea());
             TInvoiceDevice tInvoiceDevice = deviceService.selectRegionalHeadByWorkArea(invoice.getWorkArea());

+ 16 - 4
master/src/main/java/com/ruoyi/project/invoice/controller/TInvoiceBookingworkticketController.java

@@ -19,6 +19,7 @@ import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.project.invoice.domain.TApproveReserveInvoice;
 import com.ruoyi.project.invoice.domain.TInvoiceBookingworkticket;
 import com.ruoyi.project.invoice.domain.TInvoiceWorkcontent;
+import com.ruoyi.project.invoice.mapper.TInvoiceWorkcontentMapper;
 import com.ruoyi.project.invoice.service.ITApproveReserveInvoiceService;
 import com.ruoyi.project.invoice.service.ITInvoiceBookingworkticketService;
 import com.ruoyi.project.plant.domain.TStaffmgr;
@@ -33,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.io.*;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
@@ -61,6 +63,9 @@ public class TInvoiceBookingworkticketController extends BaseController
     @Autowired
     private ITApproveReserveInvoiceService tApproveReserveInvoiceService;
 
+    @Resource
+    private TInvoiceWorkcontentMapper tInvoiceWorkcontentMapper;
+
 
     /**
      * 查询预约作业票台账列表
@@ -422,7 +427,15 @@ public class TInvoiceBookingworkticketController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody TInvoiceBookingworkticket tInvoiceBookingworkticket)
     {
-       //先查当前登录的用户关联的承包商信息, 将名称 联系人 电话 都关联起来
+        List<TInvoiceWorkcontent>  workcontentList = tInvoiceBookingworkticket.gettInvoiceWorkcontentList();
+        if (workcontentList.get(0).getXpxp().equals("12")) { //续票
+           int i =  tInvoiceWorkcontentMapper.countXp(workcontentList.get(0));
+            logger.info("预约票数量:" + i);
+           if (i >= 15) {
+               return AjaxResult.error("超过预约票数量上限15");
+           }
+        }
+        //先查当前登录的用户关联的承包商信息, 将名称 联系人 电话 都关联起来
         String createAccount = SecurityUtils.getUsername();
         SysUser sysUser=sysUserService.selectUserByUserName(createAccount);
         tInvoiceBookingworkticket.setCreaterCode(getUserId());
@@ -430,9 +443,8 @@ public class TInvoiceBookingworkticketController extends BaseController
         tInvoiceBookingworkticket.setPhonenumber(sysUser.getPhonenumber());
         tInvoiceBookingworkticketService.insertTInvoiceBookingworkticket(tInvoiceBookingworkticket);
         Long didi=tInvoiceBookingworkticket.getId();
-        List<TInvoiceWorkcontent>  w=tInvoiceBookingworkticket.gettInvoiceWorkcontentList();
-        for(int i=0;i<w.size();i++){
-             TInvoiceWorkcontent wt= w.get(i);
+        for(int i=0;i<workcontentList.size();i++){
+             TInvoiceWorkcontent wt= workcontentList.get(i);
             wt.setBookingticketId(didi);
             //关联的票号
             tInvoiceBookingworkticketService.insertTInvoiceWorkcontent(wt);

+ 2 - 0
master/src/main/java/com/ruoyi/project/invoice/mapper/TInvoiceWorkcontentMapper.java

@@ -70,4 +70,6 @@ public interface TInvoiceWorkcontentMapper extends BaseMapper<TInvoiceWorkconten
      * @return 预约作业内容
      */
     List<TInvoiceWorkcontent> selectTInvoiceWorkcontentBybookingticketId(Long bookingticketId);
+
+    int countXp(TInvoiceWorkcontent tInvoiceWorkcontent);
 }

+ 2 - 1
master/src/main/java/com/ruoyi/project/invoice/service/impl/TInvoiceWorkcontentServiceImpl.java

@@ -7,6 +7,7 @@ import com.ruoyi.project.invoice.service.ITInvoiceWorkcontentService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -18,7 +19,7 @@ import java.util.List;
 @Service
 public class TInvoiceWorkcontentServiceImpl extends ServiceImpl<TInvoiceWorkcontentMapper, TInvoiceWorkcontent> implements ITInvoiceWorkcontentService
 {
-    @Autowired
+    @Resource
     private TInvoiceWorkcontentMapper tInvoiceWorkcontentMapper;
 
     /**

+ 13 - 0
master/src/main/resources/mybatis/ehs/TJobticketMapper.xml

@@ -109,6 +109,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </where>
     </select>
 
+    <select id="countXp" parameterType="TJobticket" resultType="int">
+        select count(1) from  t_jobticket d
+        <where>
+            <if test="whgzxkzh != null  and whgzxkzh != ''"> and d.whgzxkzh = #{whgzxkzh}</if>
+            <if test="dhzyxkzh != null  and dhzyxkzh != ''"> and d.dhzyxkzh = #{dhzyxkzh}</if>
+            <if test="xzkjxkzh != null  and xzkjxkzh != ''"> and d.xzkjxkzh = #{xzkjxkzh}</if>
+            <if test="mbzyxkzh != null  and mbzyxkzh != ''"> and d.mbzyxkzh = #{mbzyxkzh}</if>
+            <if test="gczyxkzh != null  and gczyxkzh != ''"> and d.gczyxkzh = #{gczyxkzh}</if>
+            <if test="deptId != null "> and d.dept_id = #{deptId}</if>
+            and d.del_flag = 0 and d.xpxp = 12 and d.zypzt != 20
+        </where>
+    </select>
+
     <insert id="insertTJobticket" parameterType="TJobticket">
         <selectKey keyProperty="id" resultType="long" order="BEFORE">
             SELECT seq_t_jobticket.NEXTVAL as id FROM DUAL

+ 1 - 3
master/src/main/resources/mybatis/invoice/TInvoiceBookingworkticketMapper.xml

@@ -189,7 +189,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="workEndTime != null">work_end_time,</if>
             <if test="delFlag != null">del_flag,</if>
             <if test="createrCode != null">creater_code,</if>
-            <if test="createdate != null">createdate,</if>
             <if test="updaterCode != null">updater_code,</if>
             <if test="updatedate != null">updatedate,</if>
             <if test="contact != null">contact,</if>
@@ -211,7 +210,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="workEndTime != null">#{workEndTime},</if>
             <if test="delFlag != null">#{delFlag},</if>
             <if test="createrCode != null">#{createrCode},</if>
-            <if test="createdate != null">#{createdate},</if>
             <if test="updaterCode != null">#{updaterCode},</if>
             <if test="updatedate != null">#{updatedate},</if>
             <if test="contact != null">#{contact},</if>
@@ -220,7 +218,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId != null">#{deptId},</if>
             <if test="userMg != null">#{userMg},</if>
             <if test="userUnit != null">#{userUnit},</if>
-            <if test="reservationNumber != null">reservation_number = #{reservationNumber},</if>
+            <if test="reservationNumber != null">#{reservationNumber},</if>
             <if test="filename != null">#{filename},</if>
          </trim>
     </insert>

+ 18 - 2
master/src/main/resources/mybatis/invoice/TInvoiceWorkcontentMapper.xml

@@ -66,6 +66,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ${params.dataScope}
     </select>
 
+    <select id="countXp" parameterType="TInvoiceWorkcontent" resultType="int">
+        select count(1) from  t_invoice_workcontent d
+            left join t_invoice_bookingworkticket b on b.id = d.bookingticket_id
+        <where>
+            <if test="whgzxkzh != null  and whgzxkzh != ''"> and d.whgzxkzh = #{whgzxkzh}</if>
+            <if test="dhzyxkzh != null  and dhzyxkzh != ''"> and d.dhzyxkzh = #{dhzyxkzh}</if>
+            <if test="xzkjxkzh != null  and xzkjxkzh != ''"> and d.xzkjxkzh = #{xzkjxkzh}</if>
+            <if test="mbzyxkzh != null  and mbzyxkzh != ''"> and d.mbzyxkzh = #{mbzyxkzh}</if>
+            <if test="gczyxkzh != null  and gczyxkzh != ''"> and d.gczyxkzh = #{gczyxkzh}</if>
+            <if test="deptId != null "> and d.dept_id = #{deptId}</if>
+            and d.del_flag = 0 and xpxp = 12 and b.status != 7
+        </where>
+    </select>
+
+
+
     <select id="selectTInvoiceWorkcontentById" parameterType="Long" resultMap="TInvoiceWorkcontentResult">
         <include refid="selectTInvoiceWorkcontentVo"/>
         where id = #{id}
@@ -162,8 +178,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="gczyxkzh != null">gczyxkzh = #{gczyxkzh},</if>
             <if test="gczyjb != null">gczyjb = #{gczyjb},</if>
             <if test="tag != null">tag = #{tag},</if>
-            <if test="gczyjb != null">yqxkzh = #{yqxkzh},</if>
-            <if test="tag != null">xpxp = #{xpxp},</if>
+            <if test="yqxkzh != null">yqxkzh = #{yqxkzh},</if>
+            <if test="xpxp != null">xpxp = #{xpxp},</if>
         </trim>
         where id = #{id}
     </update>

+ 0 - 1
ui/src/views/ehs/jobticket/index.vue

@@ -839,7 +839,6 @@ export default {
       if (postponeNumber > 15) {
         return this.msgError("当前作业票最多可以延期十五次,请重新开票");
       } else {
-
         if (this.postponeParams.yqxkzh.endsWith('-6')) {
           this.msgError("每张续票最多可以延期五次,请重新命名生成新的续票");
           this.getList();

+ 24 - 11
ui/src/views/invoice/bookingworkticket/index.vue

@@ -241,6 +241,14 @@
             @click="handleDownload(scope.row)"
           >{{ $t('下载申请单') }}
           </el-button>
+<!--          <el-dropdown size="mini">-->
+<!--            <span class="el-dropdown-link" >其他操作<i class="el-icon-arrow-down el-icon&#45;&#45;right" /></span>-->
+<!--            <el-dropdown-menu slot="dropdown">-->
+<!--              <el-dropdown-item command="handleUpdate">编辑</el-dropdown-item>-->
+<!--              <el-dropdown-item  command="handleEnabled">启用</el-dropdown-item>-->
+<!--              <el-dropdown-item  command="handleDisabled">禁用</el-dropdown-item>-->
+<!--            </el-dropdown-menu>-->
+<!--          </el-dropdown>-->
         </template>
       </el-table-column>
     </el-table>
@@ -423,7 +431,7 @@
       <el-form :model="xpForm" ref="xpForm" label-width="60px">
         <el-form-item label="作业时间" prop="workStartTime">
           <el-date-picker clearable size="small" style="width: 190px"
-                          v-model="form.workStartTime"
+                          v-model="xpForm.workStartTime"
                           type="date"
                           value-format="yyyy-MM-dd"
                           placeholder="选择作业时间">
@@ -776,7 +784,14 @@ export default {
     //作业票统计
     tickedStatis() {
       let putData = this.$refs.multipleTable.selection
-
+      for (let i = 0; i <putData.length ; i++) {
+        if (putData[i].bookingworkticket.status != 3) {
+          this.$alert(this.$t('只能提交状态为已完成的预约票'), this.$t('提示'), {
+            type: 'warning'
+          })
+          return
+        }
+      }
       batchAddJobticket(putData).then(response => {
         this.msgSuccess(this.$t(response.msg));
       });
@@ -1158,14 +1173,11 @@ export default {
               this.approveForm.userSupId = this.form.userMg
               addInvoice(this.approveForm).then(response => {
                 this.msgSuccess("已提交申请");
+                this.open = false;
+                this.getList();
+                this.resetForm1();
+                this.cancel();
               })
-
-              this.msgSuccess("新增成功");
-              //     console.log(this.queryParams.createdate)
-              this.open = false;
-              this.getList();
-              this.resetForm1();
-              this.cancel();
             });
 
           }
@@ -1227,6 +1239,7 @@ export default {
       this.form.tInvoiceWorkcontentList = []
       this.xpForm.bookingworkticket = null
       this.form.tInvoiceWorkcontentList[0] = this.xpForm
+      this.form.workStartTime = this.xpForm.workStartTime
       this.form.tInvoiceWorkcontentList[0].xpxp = 12    //续票
       this.form.status = 0
       addBookingworkticket(this.form).then(response => {
@@ -1234,9 +1247,9 @@ export default {
         this.approveForm.userSupId = this.form.userMg
         addInvoice(this.approveForm).then(response => {
           this.msgSuccess("已提交申请");
+          this.getList();
+          this.xpVisible = false
         })
-        this.getList();
-        this.xpVisible = false
       });
     },
     //关联票号