wtt
2024-10-31 8a829f00d0582a32c7bef960cab5c6fd855c5ea5
WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs
@@ -477,7 +477,7 @@
                if (oBill.omodel.HInterID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    //部门,发现人,负责人,设备
                    _ = SendDingDingAsync(oBill.omodel.HDeptID, oBill.omodel.HEmpID, oBill.omodel.HManagerID, oBill.omodel.HEquipID,2);
                }
@@ -819,7 +819,10 @@
                if (oBill.omodel.HInterID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    //反写维修记录单关闭
                    string sql = "Update Sb_EquipRepairWorkBillMain set HCloseMan='关联验收单自动关闭',HCloseDate=GETDATE(),HBillStatus=3,HCloseType = 1 Where HInterID=" + oBill.omodel.HMainSourceInterID.ToString();
                    ds = oCN.RunProcReturn(sql, "Sb_EquipRepairWorkBillMain");
                    //部门,发现人,负责人,设备
                    _ = SendDingDingAsync(oBill.omodel.HDeptID, oBill.omodel.HEmpID, oBill.omodel.HManagerID, oBill.omodel.HEquipID, 3);
                }
@@ -1323,8 +1326,8 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //得到信息
                ds = oCN.RunProcReturn("select top 1 * from h_v_Gy_EquipFileBillList where HBarCode= '" + HBarCode + "'", "Gy_EquipFileBillMain");
                //得到信息最新的
                ds = oCN.RunProcReturn("select  * from h_v_Gy_EquipFileBillList where HBarCode= '" + HBarCode + "'  order by 故障登记单ID desc", "Gy_EquipFileBillMain");
                //写入信息
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
@@ -1332,6 +1335,14 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "1.未查询到设备信息! 2.设备没有维护故障登记单  3.设备故障登记单没有审核";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if ( ds.Tables[0].Rows.Count > 1)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "该设备出现多个故障登记单,请手动选着";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                objJsonResult.code = "1";
@@ -2945,8 +2956,97 @@
            }
        }
        #endregion
        #region 设备签到单提交PDA
        [Route("Sb_CheckEqpRepairWorkBill/SaveSb_EquipRepairSignBill_PDA")]
        [HttpPost]
        public object SaveSb_EquipRepairSignBill_PDA([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
            {
                DLL.ClsSb_EquipRepairSignBill oBill = new DLL.ClsSb_EquipRepairSignBill();
                List<Models.ClsSb_EquipRepairSignBillMain> lsmain = new List<Models.ClsSb_EquipRepairSignBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Sb_EquipRepairSignBill_PDA(msg2);
                foreach (Models.ClsSb_EquipRepairSignBillMain oItem in lsmain)
                {
                    //单据号是否重复
                    if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号重复!不允许保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3920";
                    oItem.HBillSubType = "3920";
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.omodel.HInterID == 0)
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region 设备故障 登记/记录/验收  发送消息
        /// <summary>
        /// 异常反馈 接收,处理,验收单保存发送消息