|  |  | 
 |  |  | using System.Data.SqlClient; | 
 |  |  | using System.Web.Http; | 
 |  |  | using WebAPI.Models; | 
 |  |  | using System.Windows.Forms; | 
 |  |  |  | 
 |  |  | namespace WebAPI.Controllers | 
 |  |  | { | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                     //审核提交 | 
 |  |  |                     if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
 |  |  |                     oCN.BeginTran(); | 
 |  |  |                     //增加关联 | 
 |  |  |                     oCN.RunProc("exec h_p_Kf_SellOutBill_Check " + HInterID + ",'" + oBill.BillType + "','" + CurUserName + "'"); | 
 |  |  |                     //写入日志 | 
 |  |  |                     string WorkList = "审核单据,单据号:" + oBill.omodel.HBillNo; | 
 |  |  |                     string SystemName = "LMES-销售出库单模块"; | 
 |  |  |                     oCN.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + | 
 |  |  |                         "(getdate(),'" + CurUserName + "','" + SystemInformation.ComputerName + "','" + WorkList + "','" + SystemName + "','','审核')" | 
 |  |  |                         ); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                     //审核后控制=========================================       | 
 |  |  |                     string sql = "exec h_p_Kf_SellOutBill_AfterCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_p_Kf_SellOutBill_AfterCheckCtrl"); | 
 |  |  |                     if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "1"; | 
 |  |  |                         objJsonResult.count = 1; | 
 |  |  |                         objJsonResult.Message = "审核成功"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         oCN.RollBack(); | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; | 
 |  |  |                         objJsonResult.Message = "审核失败!原因:审核过程中出错,请与网络管理人员联系"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") | 
 |  |  |                     { | 
 |  |  |                         oCN.RollBack(); | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //=========================================       | 
 |  |  |  | 
 |  |  |                     oCN.Commit(); | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "审核成功"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |  | 
 |  |  |                     //if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
 |  |  |                     //{ | 
 |  |  |                     //    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 (IsAudit == 1) //反审核提交 | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                     //===========================================================          | 
 |  |  |  | 
 |  |  |                     //反审核提交AbandonCheck | 
 |  |  |                     //删除关联 | 
 |  |  |                     oCN.BeginTran(); | 
 |  |  |                     oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_UnCheck " + HInterID + ",'" + CurUserName + "'"); | 
 |  |  |                     if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
 |  |  |                     { | 
 |  |  |                         oCN.Commit(); | 
 |  |  |                         objJsonResult.code = "1"; | 
 |  |  |                         objJsonResult.count = 1; | 
 |  |  |                         objJsonResult.Message = "反审核成功"; | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         oCN.RollBack(); | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; | 
 |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 oCN.RollBack(); | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 销售出库单 检查单据是否存在 | 
 |  |  |         /// <summary> | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="HInterID">单据ID</param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Kf_SellOutBill/CheckSellOutBill_IsExist")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object CheckSellOutBill_IsExist(int HInterID) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //HInterID数据判断 | 
 |  |  |                 if (HInterID <= 0) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "HInterID小于0!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 Int64 lngBillKey = 0; | 
 |  |  |                 lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换 | 
 |  |  |                 DAL.ClsKf_SellOutBill oBill = new DAL.ClsKf_SellOutBill();                              //实例化单据操作类,用于进行相关操作 | 
 |  |  |  | 
 |  |  |                 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 | 
 |  |  |                 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据 | 
 |  |  |                 { | 
 |  |  |                     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; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "程序错误!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |     } | 
 |  |  | } |