| | |
| | | { |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | |
| | | NewBarCode = sBillBarCode.Split(Convert.ToChar("#")); |
| | | sBillBarCode = NewBarCode[0]; |
| | | } |
| | | string sBillNo = sBillBarCode; |
| | | //截取条码类型 |
| | | string BillNoType = sBillNo.Substring(0, Math.Min(3, sBillNo.Length)); |
| | | //截取条码类型2 |
| | | string BillNoType2 = sBillNo.Substring(0, Math.Min(4, sBillNo.Length)); |
| | | string sBillNo = sBillBarCode; //条形码 |
| | | |
| | | string[] arr = sBillNo.Split('&'); //以符号‘&’分割条形码 |
| | | string BillNo_PGD = arr[0]; //单据号 |
| | | string entryid_PGD = "";//子id |
| | | if(arr.Length > 1) |
| | | { |
| | | entryid_PGD = arr[1]; |
| | | } |
| | | |
| | | //截取条码类型 前三位 |
| | | string BillNoType = BillNo_PGD.Substring(0, Math.Min(3, BillNo_PGD.Length)); |
| | | //截取条码类型2 前四位 |
| | | string BillNoType2 = BillNo_PGD.Substring(0, Math.Min(4, BillNo_PGD.Length)); |
| | | //截取内码 |
| | | string BillNo = sBillNo.Substring(3, Math.Min(sBillNo.Length - 3,sBillNo.Length)); |
| | | string BillNo = BillNo_PGD.Substring(3, Math.Min(BillNo_PGD.Length - 3, BillNo_PGD.Length)); |
| | | switch (BillNoType2) |
| | | { |
| | | case "GXLZ"://工序流转派工 |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcExchSendWorkBill where 派工单据号 = '" + sBillNo + "'", "h_v_Sc_ProcExchSendWorkBill"); |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcExchSendWorkBill where 派工单据号 = '" + BillNo_PGD + "'" + " and HEntryID ='" + entryid_PGD + "'", "h_v_Sc_ProcExchSendWorkBill"); |
| | | break; |
| | | case "GXLX"://流转卡 |
| | | ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + sBillNo + "'", "h_v_Sc_ProcessExchangeBillList"); |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "乔一") |
| | | { //系统参数是否为只显示当前登录用户关联的工序信息,N为否,Y为是 |
| | | if (oSystemParameter.omodel.MES_StationInBill_ShowUSERProcess == "Y") |
| | | { |
| | | ds = oCN.RunProcReturn($"exec h_p_ProcessExchangeBillLastHProNo '{BillNo_PGD}','{UserID}','{HBillType}'", "h_v_Gy_ProcessList_GetProcNoByUser"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + BillNo_PGD + "'", "h_v_Sc_ProcessExchangeBillList"); |
| | | } |
| | | } |
| | | else if (entryid_PGD != "") //如果子id不为空则加入子id过滤; |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + BillNo_PGD + "'" + " and hsubid ='" + entryid_PGD + "'", "h_v_Sc_ProcessExchangeBillList"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + BillNo_PGD + "'", "h_v_Sc_ProcessExchangeBillList"); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | switch (BillNoType) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 工序委外发出单关闭/反关闭功能 |
| | | [Route("Cj_StationEntrustInBill/CloseCj_StationEntrustInBill")] |
| | | [HttpGet] |
| | | public object CloseCj_StationEntrustInBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustInBill_Close", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Sc_StationInBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 关闭 2 反关闭 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不需要再关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //关闭单据 |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反关闭!不需要再反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //反关闭单据 |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据id删除委外发出单 |
| | | [Route("Cj_StationEntrustInBill/del_StationEntrustInBill")] |
| | | [HttpGet] |