| | |
| | | using System.IO; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using System.Windows.Forms; |
| | | using WebAPI.Models; |
| | | |
| | | namespace WebAPI.Controllers |
| | |
| | | //反序列化 |
| | | string msg2 = "[" + sArray[0].ToString() + "]"; |
| | | string user = sArray[1].ToString();//用户名 |
| | | string HComputerName = SystemInformation.ComputerName; //设备名称 |
| | | |
| | | //判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user)) |
| | |
| | | double HWorkTimes = list[0].HWorkTimes;//工时 |
| | | long HQCCheckID = list[0].HQCCheckID;//检验员ID |
| | | long HPRDOrgID = list[0].HPRDOrgID;//组织ID |
| | | double HmaterOutqty = list[0].HmaterOutqty;//白坯发布 |
| | | //单据完整性判断 |
| | | if (HProcExchInterID <= 0) |
| | | { |
| | |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | //判断客户不为龙山汽配 |
| | | if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配") //系统参数 |
| | | if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配"&& oSystemParameter.omodel.WMS_CampanyName != "瑞与祺") //系统参数 |
| | | { |
| | | if (HSourceID == 0) |
| | | { |
| | |
| | | ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + |
| | | ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + |
| | | ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" + |
| | | ",HmaterOutqty" + |
| | | ") " + |
| | | " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + |
| | | "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + |
| | |
| | | "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" + |
| | | "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + |
| | | "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID + |
| | | ") "); |
| | | ","+ HmaterOutqty + ") "); |
| | | |
| | | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增工序出站单据:" + HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "新增工序出站单据:" + HBillNo + "','LMES-工序出站模块','" + DBUtility.ClsPub.IPAddress + "','新增单据'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else if ("Modify".Equals(eventType)) |
| | | { |
| | |
| | | ",HWasterQty=" + HWasterQty + |
| | | ",HLastSubProc=" + Convert.ToString(HLastSubProc ? 1 : 0) + |
| | | " where HInterID=" + HInterID); |
| | | |
| | | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",修改工序出站单据:" + HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "修改工序出站单据:" + HBillNo + "','LMES-工序出站模块','" + DBUtility.ClsPub.IPAddress + "','修改单据'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | if (oSystemParameter.omodel.MES_StationOutBill_SaveAutoAddnew == "Y") //系统参数 自动审核 |
| | | if (oSystemParameter.omodel.MES_StationOutBill_SaveAutoAddnew == "Y") //系统参数 页面保存自动变成新增状态 |
| | | { |
| | | objJsonResult.Verify = "Y"; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | string HComputerName = SystemInformation.ComputerName; //设备名称 |
| | | //编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan)) |
| | | { |
| | |
| | | DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill(); |
| | | if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin")) |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "只能删除本人的单据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | if (oSystemParameter.omodel.MES_StationOutBill_DeleteCtl == "Y") |
| | | { |
| | | if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "只能删除本人的单据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //写入删除日志 |
| | | string WorkList = "删除出站单:" + oBill.omodel.HBillNo; |
| | | if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | else |
| | | { |
| | | //写入删除日志 |
| | | LogService.Write("用户:" + HDeleteMan + ",日期:" + DateTime.Now + ",删除工序出站单据:" + oBill.omodel.HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + HDeleteMan + "','" + HComputerName + "','" + "删除工序出站单据:" + oBill.omodel.HBillNo + "','LMES-工序出站模块','" + DBUtility.ClsPub.IPAddress + "','删除单据'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | |
| | | #region 审核 |
| | | [Route("Cj_StationOutBill/set_CheckBill")] |
| | | [HttpGet] |
| | | public object set_CheckBill(int HInterID, string CurUserName) |
| | | public object set_CheckBill(string HInterID, string CurUserName) |
| | | { |
| | | try |
| | | { |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (HInterID == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据ID为0,不能审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | var HBillNo = HInterID.Split(','); |
| | | DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill(); |
| | | //查看是否已审核,关闭,作废 |
| | | if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | |
| | | for (int i = 0; i < HBillNo.Length; i++) |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() != "") |
| | | if (HBillNo[i] == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核"; |
| | | objJsonResult.Message = "第"+(i+1)+"行:单据ID为0,不能审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //查看是否已审核,关闭,作废 |
| | | if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + (i + 1) + "行:单据已审核!不能再次审核"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + (i + 1) + "行:单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | |
| | | int j = 0; |
| | | for (int i = 0; i < HBillNo.Length; i++) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //审核 |
| | | if (Cj_StationOutBillCheckBill(HInterID, CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | //审核 |
| | | if (Cj_StationOutBillCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | j += 1; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "成功:" + j + "行,第" + (i + 1) + "行:审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "全部执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | #region 反审核 |
| | | [Route("Cj_StationOutBill/set_AbandonCheck")] |
| | | [HttpGet] |
| | | public object set_AbandonCheck(int HInterID, string CurUserName) |
| | | public object set_AbandonCheck(string HInterID, string CurUserName) |
| | | { |
| | | try |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (HInterID == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据ID为0,不能反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | var HBillNo = HInterID.Split(','); |
| | | DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill(); |
| | | //查看是否已审核,关闭,作废 |
| | | if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | |
| | | //获取系统参数 |
| | | string Ret = ""; |
| | | oSystemParameter.ShowBill(ref Ret); |
| | | |
| | | for (int i = 0; i < HBillNo.Length; i++) |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | if (long.Parse(HBillNo[i]) == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.Message = "第" + (i + 1) + "行:单据ID为0,不能反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //查看是否已审核,关闭,作废 |
| | | if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + (i + 1) + "行:单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //审核人必须和反审核人保持一致 乔一 |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "乔一") |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() != CurUserName) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + (i + 1) + "行:审核人和反审核人不一致!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + (i + 1) + "行:单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | |
| | | int j = 0; |
| | | for (int i = 0; i < HBillNo.Length; i++) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | //反审核 |
| | | if (Cj_StationOutBillAbandonCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | j += 1; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "成功:" + j + "行,第" + (i + 1) + "行:反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //反审核 |
| | | if (Cj_StationOutBillAbandonCheckBill(HInterID, CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "全部执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |