コード例 #1
0
        /// <summary>
        /// 点击按钮传递平均单价
        /// </summary>
        /// <param name="e"></param>
        public override void AfterButtonClick(AfterButtonClickEventArgs e)
        {
            base.AfterButtonClick(e);
            if (e.Key.ToUpperInvariant().Equals("FPASSONMEDPRICE"))
            {
                string strSql = string.Format(@"/*dialect*/SELECT MAT.FNUMBER,
         sum(spData.FAMOUNT)/sum(spData.FACTUALQTY) avgPrice
FROM T_SP_PICKMTRL sp
INNER JOIN T_SP_PICKMTRLDATA spData
    ON sp.FID = spData.FID
INNER JOIN T_BD_MATERIAL MAT
    ON spData.FMATERIALID = MAT.FMATERIALID
WHERE sp.FPRDORGID = 111934 

group by MAT.FNUMBER");
                DynamicObjectCollection result = DBUtils.ExecuteDynamicObject(this.Context, strSql);
                if (result != null && result.Count() > 0)
                {
                    string sJson = CreateJson(result);
                    if (!sJson.Equals("传递参数拼接失败"))
                    {
                        WebMesTest.MaterialMessageFromCappServiceService requestMes = new WebMesTest.MaterialMessageFromCappServiceService();
                        requestMes.WeightingAvgNumerAsync(sJson);

                        //ResManager
                        //调用MES提供的接口
                    }
                }
            }
        }
コード例 #2
0
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            //test();
            base.EndOperationTransaction(e);

            /*
             * 标准件入库单
             * 单据头
             * 入库单号
             * 项目号
             * 单据体
             * 物料编号
             * 数量
             * 批号
             * ************************************
             * 外协件入库单
             * 单据头
             * 入库单号
             * 项目号
             * 单据体
             * 物料编号
             * 数量
             * 批号
             * 外协计划号
             */
            if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0)
            {
                foreach (DynamicObject DataEntity in e.DataEntitys)
                {
                    //标准采购入库
                    if (Convert.ToString(((DynamicObject)DataEntity["StockOrgId"])["Number"]).Equals("0168"))
                    {
                        DynamicObjectCollection inStockEntrys = DataEntity["InStockEntry"] as DynamicObjectCollection;
                        if (!Convert.ToString(((DynamicObject)inStockEntrys[0]["MaterialId"])["Name"]).Contains("标准件"))
                        {
                            string sJon = CreateJson(DataEntity);
                            if (!sJon.Equals("传递参数拼接失败"))
                            {
                                //ResManager
                                //调用MES提供的接口
                                WebMesTest.MaterialMessageFromCappServiceService requestMes = new WebMesTest.MaterialMessageFromCappServiceService();
                                string mesResult = requestMes.StorageMessageFromKis(sJon);
                                if (!mesResult.Equals("0"))//传递失败
                                {
                                    throw new Exception(mesResult);
                                }
                            }
                        }
                    }


                    //外协采购入库
                    //else if (Convert.ToString(DataEntity["FBillTypeID"]).Equals(""))
                    //{
                    //    CreateJson(DataEntity);
                    //}
                }
            }
        }