wtt
3 天以前 96762a572dd7d89969940d34f9cf4200716f5ff7
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -23,6 +23,7 @@
        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();
        public WebS.WebService1 oWebs = new WebS.WebService1();
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
@@ -521,7 +522,7 @@
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-2-015]数量控制," + ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -629,6 +630,15 @@
                    else
                    {
                        objJsonResult.Verify = "N";
                    }
                }
                //判断是否是新增
                if ("Add".Equals(eventType))
                {
                    //判断客户为海诚 同步金蝶工序汇报单
                    if (oSystemParameter.omodel.WMS_CampanyName == "海诚")
                    {
                        object objResult = set_SaveStationOutBill_CLD_Json(HInterID, HBillNo, user);
                    }
                }
                sw.Stop();//结束计时
@@ -2649,6 +2659,7 @@
        [HttpGet]
        public object set_ShowBillJudge(string HBillNo)
        {
            string sReturn = "";
            try
            {
                ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_DelCtrl  '" + HBillNo + "'", "h_p_MES_StationOutBill_DelCtrl");
@@ -2664,7 +2675,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-1-038]" + Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                    objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -2679,11 +2690,34 @@
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
                if (oSystemParameter.ShowBill(ref sReturn) == true)
                {
                    if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔") //系统参数  判断客户
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = e.ToString();
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
        }
        #endregion
@@ -3263,7 +3297,86 @@
        }
        #endregion
        #region 工序汇报单流水号回车获取工序信息(带子序列)
        [Route("Cj_StationOutBill/txtHProcNo_KeyDown")]
        [HttpGet]
        public object txtHProcNo_KeyDown(string sBillNo, string sProcNo,string HSEQNumber)
        {
            try
            {
                if (sBillNo.Equals("") || sProcNo.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-2-019]条形码不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //得到信息(委外标记为0时,流转标记为1时)
                ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList_Sec  where 单据号= '" + sBillNo + "' and 下道流转工序<>'转' and 委外标记=0 and 流转标记=1  and 工序号='" + sProcNo + "' and 序列号='"+ HSEQNumber+"'", "h_v_Sc_ProcessExchangeBillList_Sec");
                //Ds = oCn.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList  where 单据号= '" + sBillNo + "' and 工序号='" + sProcNo + "' and 委外标记=0 and 流转标记=1 ", "h_v_Sc_ProcessExchangeBillList");
                //写入信息
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[3790-2-013]工序号错误或者当前工序号不允许进站,请重新输入!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "[0000-1-037]Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 工序汇报单获取对应所以序列
        [Route("Cj_StationOutBill/getAllHSEQ")]
        [HttpGet]
        public object getAllHSEQ(string HInterID)
        {
            try
            {
                //得到信息(委外标记为0时,流转标记为1时
                ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillSEQ  where HInterID= " + HInterID, "Sc_ProcessExchangeBillSEQ");
                //写入信息
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "子序列缺失";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "[0000-1-037]Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region //是否被关联
        public bool Cj_StationInBillisUse(Int64 lngBillKey, ref string sReturn)
@@ -4241,5 +4354,68 @@
            }
        }
        #endregion
        #region 工序汇报单同步至金蝶云
        /// <summary>
        /// 工序汇报单同步至金蝶云
        /// </summary>
        /// <returns></returns>
        [Route("Cj_StationOutBill/set_SaveStationOutBill_CLD_Json")]
        [HttpGet]
        public object set_SaveStationOutBill_CLD_Json(Int64 HInterID, string HBillNo, string HMaker)
        {
            try
            {
                //同步前控制=========================================
                ds = oCN.RunProcReturn("Exec  h_p_Sc_StationOutBill_BeforeSyncCtrl  " + HInterID.ToString() + ", '" + HBillNo + "','" + HMaker + "'", " h_p_Sc_StationOutBill_BeforeSyncCtrl ");
                if (ds == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-2-012]保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-1-051]同步失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                if (oWebs.set_SaveStationOutBill_CLD(HInterID, HBillNo, HMaker, ref DBUtility.ClsPub.sErrInfo))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "同步至金蝶云失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}