|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | UserName = oItem.HMaker;  //制单人 | 
|---|
|  |  |  | oItem.HBillType = "1401"; | 
|---|
|  |  |  | oItem.HBillSubType = "1401"; | 
|---|
|  |  |  | //oItem.HBillSubType = "1401"; | 
|---|
|  |  |  | oItem.HSALEORGID = oItem.HOrgID; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (IsAudit == 1) //反关闭提交 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oBill.oCn.BeginTran(); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //反关闭提交 | 
|---|
|  |  |  | if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | oBill.oCn.RollBack(); | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oBill.oCn.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "反关闭成功"; | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | oBill.oCn.RollBack(); | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (IsAudit == 1) //行反关闭提交 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //oBill.oCn.BeginTran(); | 
|---|
|  |  |  | //行反关闭提交 | 
|---|
|  |  |  | if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); | 
|---|
|  |  |  | //if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    oBill.oCn.RollBack(); | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "反关闭成功"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | //oBill.oCn.Commit(); | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | //oBill.oCn.RollBack(); | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql = "select * from Gy_UserCustomerRelation where HUserID = '" + CurUserID + "'"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation"); | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sWhere = " and 1 = 0"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sWhere = " and HCusID in ("; | 
|---|
|  |  |  | for (var i = 0; i < ds.Tables[0].Rows.Count; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (i < ds.Tables[0].Rows.Count - 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ","; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ")"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //sWhere = " and 1=1 "; | 
|---|
|  |  |  | sWhere = " and HCusID in (select hcusid from Gy_UserCustomerRelation Where HUserID = '" + CurUserID + "') "; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|