钟表维修管理系统技术解析 工单派工(三)

本文详细介绍了工单派工模块的实现思路、界面设计、数据库表结构、控件使用、控制器代码以及jQuery实现细节,包括行颜色更改、动态生成维修师傅、控制器逻辑和保存派工等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


工单派工模块

工单派工是对工单进行维修师傅分配的操作,就是指定某条工单由某个师傅负责维修,派工可以进行修改(更换维修师傅),每一次派工都会生成派工记录。新的单据选择维修师傅后单据的颜色会变成墨绿色,保存或取消选择后恢复白色。

 

实现思路:

      在创建表格的时候,加一个隐藏列,当我选择维修师傅的时候给这一列赋值为1,而且表格还要定义rowStyler方法,这个方法是更改行样式,当隐藏列赋值为1是更改行的颜色。当点击取消选择时,单据回滚到原来的状态。当点击保存所选派工时,获取整张表的数据进行遍历,通过判断隐藏列的值来保存所选的维修师傅。

 

界面效果图:


2.2.4 (图1)



2.2.4(图2)

从界面上看特殊的控件使用就是表的行的颜色变化。

第一步:数据库

表与关系:

2.2.4 (图3)

表1:工单派工表(pw_GongDianLuRu)

列名

数据类型

主键/外键

说明

GongDanPaiGongID

int

主键

工单派工ID

GongDanLuRuID

int

外键

工单录入ID

CaoZuoYuanID

int

外键

操作员ID

WeiXiuShiFuID

int

外键

维修师傅ID

GengXingShiJian

datetime

 

更新时间

YouXiaoFou

bit

 

有效否

表2:工单录入表(pw_GongDianLuRu)

用于存放钟表录入的信息

列名

数据类型

主键/外键

说明

GongDanLuRuID

int

主键

工单录入ID

YuanShiDanHaoID

int

外键

原始单号ID

GongDanZhuanTaiID

int

外键

工单状态ID

JinEZhuangTaiID

int

外键

金额状态ID

GongDanLeiXingID

int

外键

工单类型ID

KeHuID

int

外键

客户ID

JianXiuLeiXingID

int

外键

检修类型ID

PinPaiID

int

外键

品牌ID

GongDanRiQi

date

 

工单日期

GongDanBianHao

nchar(50)

 

工单编号

SongXiuRiQi

data

 

送修日期

YuFanRiQi

data

 

预返日期

FenYongJinE

decimal(18, 2)

 

费用金额

ZhongBiaoLeiXing

nchar(10)

 

钟表类型

BiaoKuan

nchar(10)

 

表款

GuiGe

text

 

规格/名称

XiuPeiJiLu

text

 

修配记录

JiXinXingHao

nchar(50)

 

机芯号

BiaoXingHao

nchar(50)

 

表型号

BiaoShenHao

nchar(50)

 

表身号

BiaoDaiJieShu

nchar(50)

 

表带节数

ZhongBiaoQiTaoMiaoShu

varchar(200)

 

钟表其他描述

WaiGuan

text

 

外观

KeHuZhiShu

varchar(200)

 

客户自述

YouXiaoFou

Bit

 

有效否

表3:员工表(sys_YuanGong)

列名

数据类型

主外键

说明

YuanGongID

int

主键

员工ID

LuRuYuanID

int

外键

录入员ID

JueSeID

int

外键

角色ID

YuanGongZhuangTaiID

int

外键

员工状态ID

MenDianID

int

外键

门店ID

YuanGongBianHao

nchar(50)

 

员工编号

YuanGongXingMing

nchar(50)

 

员工姓名

XingBie

nchar(50)

 

性别

JiGuan

nchar(50)

 

籍贯

XueLi

nchar(50)

 

学历

ChuShengRiQi

date

 

出生日期

ShenFenZhengHao

nchar(50)

 

身份证号

RuZhiRiQi

date

 

入职日期

RuZhiDiDian

nchar(50)

 

入职地址

YiDongShouJi

nchar(50)

 

移动手机

JiaTingDianHua

nchar(50)

 

家庭电话

DiXin

nchar(50)

 

底薪

DianZiYouXiang

nchar(50)

 

电子邮箱

TongXunDiZhi

nchar(100)

 

通讯地址

BeiZhu

nchar(100)

 

备注

GengXinShiJian

datetime

 

更新时间

YouXiaoFou

bit

 

有效否

MiMa

 

 

密码

第二步:控件使用

更改表格(easyui-datagrid)行颜色和动态生成维修师傅

效果截图:

2.2.4(图4)


2.2.4(图5)

更改样式代码截图:



2.2.4(图6)

从图中可以看出,更改行颜色的代码写在rowStyler事件里面,这个事件第一个参数index是当前行的索引,第二个参数row是整行数据。当行里面的值改变就会触发rowStyler事件,从新给表格赋值时要刷新行才会触发rowStyler事件。

动态生成维修师傅html代码:

<table id="ServiceMaster">
        
</table>

动态生成维修师傅jQuery代码

function ServiceMasetr() {
        var LianJieStr = "<tr>";
        var RowsCount = 0;
        var CellCount = 0;
        $.getJSON("/WeiXiuGuanLi/SelectWeiXiuShiFu", function (data) {
            for (var i = 0; i < data.length; i++) {//循环拼接字符串
                RowsCount++;
                CellCount++;
                LianJieStr += "<td><table>" +
                "<tr><td align='center'><img src='../../Content/images/iconfont-zhanghao.gif' id='" + data[i]["WeiXiuShiFuID"] + "' onclick='onmousemoveStaer(this)' ondblclick='ondblClick(this)' onmousemove='onmousemoveStaer(this)' onmouseout='onmouseoutStaer(this)'/></td></tr><tr><td align='center'><label id='masterText"+data[i]["WeiXiuShiFuID"] +"'>" + data[i]["WeiXiuShiFu"] + "</label></td><tr>" +
                "</table></td>";
                if (CellCount == 4) {
                    LianJieStr = LianJieStr + "</tr><tr>";
                    CellCount = 0;
                }
            }
            LianJieStr += "</tr>";
            $("#ServiceMaster").html(LianJieStr);
        });
    }
    var ServiceMasetrID=0;
    var ServiceMasetrText=0;
    function ondblClick(data) {
        ServiceMasetrID=data.id;
        ServiceMasetrText=$.trim($("#masterText"+ServiceMasetrID+"").html());
        XuanZheWeiXiuShiFu()
    }
    function onmousemoveStaer(data) {
        data.src = "../../Content/images/iconfont-zhanghao01.gif";
        //onmousemove鼠标移入
        //onmouseout鼠标移除
    }
    function onmouseoutStaer(data) {
        data.src = "../../Content/images/iconfont-zhanghao.gif";
        //onmousemove鼠标移入
        //onmouseout鼠标移除
    }



动态生成维修师傅控制器代码:


        #region 查询维修师傅
        public ActionResult SelectWeiXiuShiFu()
        {
            int intShopID = Convert.ToInt32(Session["ShopID"]);
            var varWeiXiuShiFu = (from dtWeiXiuShiFu in myMdl.sys_YuanGong
                                  join dtJueSe in myMdl.sys_JueSe on dtWeiXiuShiFu.JueSeID equals dtJueSe.JueSeID
                                  join dtBuMen in myMdl.sys_BuMen on dtJueSe.BuMenID equals dtBuMen.BuMenID
                                  where dtBuMen.BuMenID == 2 && dtWeiXiuShiFu.MenDianID == intShopID && dtWeiXiuShiFu.YouXiaoFou == true
                                  select new
                                  {
                                      WeiXiuShiFu = dtWeiXiuShiFu.YuanGongXingMing,
                                      WeiXiuShiFuID = dtWeiXiuShiFu.YuanGongID
                                  }).AsEnumerable().Select(n => new { WeiXiuShiFu = n.WeiXiuShiFu.Trim(), n.WeiXiuShiFuID });
            return Json(varWeiXiuShiFu.ToList(), JsonRequestBehavior.AllowGet);
        }
        #endregion

第三步:控制器

2.2.4 (图7)


控制器代码:

#region 保存派工
/// <summary>
/// 保存派工
/// </summary>
/// <param name="intGongDanID"> 工单录入ID</param>
/// <param name="intWeiXiuShiFuID">维修师傅ID</param>
/// <param name="intCaoZuoYuanID">操作员ID</param>
/// <returns></returns>
public ActionResult BaoCunPaiGong(int intGongDanID, int intWeiXiuShiFuID, int intCaoZuoYuanID)
{
    var varPaiGong = (from dtPaiGong in myMdl.pw_GongDanPaiGong
                        where dtPaiGong.GongDanLuRuID == intGongDanID && dtPaiGong.YouXiaoFou == true
                        select dtPaiGong);
    if (varPaiGong.Count() > 0)
    {
        varPaiGong.Single<Models.pw_GongDanPaiGong>().YouXiaoFou = false;//如果是修改报废前一条
    }

    Models.pw_GongDanPaiGong myPaiGong = new Models.pw_GongDanPaiGong();
    myPaiGong.YouXiaoFou = true;
    myPaiGong.CaoZuoYuanID = intCaoZuoYuanID;
    myPaiGong.WeiXiuShiFuID = intWeiXiuShiFuID;
    myPaiGong.GongDanLuRuID = intGongDanID;
    myPaiGong.GengXingShiJian = DateTime.Now;
    myMdl.pw_GongDanPaiGong.AddObject(myPaiGong);
    var varGongDan = (from dtGongDan in myMdl.pw_GongDianLuRu
                        where dtGongDan.GongDanLuRuID == intGongDanID
                        select dtGongDan).Single<Models.pw_GongDianLuRu>();
    varGongDan.GongDanZhuanTaiID = 62;//工单状态为(维修中)
    if (myMdl.SaveChanges() > 0)
    {

        return Json(true, JsonRequestBehavior.AllowGet);

    }
    else
    {
        return Json(false, JsonRequestBehavior.AllowGet);
    }
}
#endregion
#region 查询刷新行工单
        /// <summary>
        /// 刷新行工单
        /// </summary>
        /// <param name="intGongDanLuRuID">工单录入ID</param>
        /// <returns></returns>
        public ActionResult ShuaXinHangGongDan(int intGongDanLuRuID)
        {
            #region 查询的数据
            var varGongDan = from dtGonDan in myMdl.pw_GongDianLuRu
                             join dtKeHu in myMdl.sys_KeHu on dtGonDan.KeHuID equals dtKeHu.KeHuID
                             join dtPinPai in myMdl.sys_PinPai on dtGonDan.PinPaiID equals dtPinPai.PinPaiID
                             join dtJinEZhuangTai in myMdl.sys_ShuXingMingXi on dtGonDan.JinEZhuangTaiID equals dtJinEZhuangTai.ShuXingMingXiID
                             join dtGongDanZhuangTai in myMdl.sys_ShuXingMingXi on dtGonDan.GongDanZhuanTaiID equals dtGongDanZhuangTai.ShuXingMingXiID
                             join dtGongDanLeiXing in myMdl.sys_ShuXingMingXi on dtGonDan.GongDanLeiXingID equals dtGongDanLeiXing.ShuXingMingXiID
                             join dtJieShouYuan in myMdl.sys_YuanGong on dtGonDan.JieShouYuanID equals dtJieShouYuan.YuanGongID
                             join dtYuanShiDanHao in myMdl.pw_GongDianLuRu on dtGonDan.YuanShiDanHaoID equals dtYuanShiDanHao.GongDanLuRuID into YuanShiGongDan
                             from dtYuanShiDanHao in YuanShiGongDan.DefaultIfEmpty()
                             join dtGongDanPaiGong in myMdl.pw_GongDanPaiGong on dtGonDan.GongDanLuRuID equals dtGongDanPaiGong.GongDanLuRuID into GongDanPaiGong
                             from dtGongDanPaiGong in GongDanPaiGong.DefaultIfEmpty()
                             join dtWeiXiuShiFu in myMdl.sys_YuanGong on dtGongDanPaiGong.WeiXiuShiFuID equals dtWeiXiuShiFu.YuanGongID into WeiXiuShiFu
                             from dtWeiXiuShiFu in WeiXiuShiFu.DefaultIfEmpty()
                             where dtGonDan.YouXiaoFou == true && dtGonDan.GongDanLuRuID == intGongDanLuRuID
                             orderby dtGonDan.GongDanLuRuID descending
                             select new
                             {
                                 dtGonDan.GongDanLuRuID,
                                 dtGonDan.GongDanLeiXingID,
                                 dtGonDan.KeHuID,
                                 dtGonDan.PinPaiID,
                                 dtGonDan.JieShouYuanID,
                                 dtGonDan.WeiXiuLeiXingID,
                                 dtGonDan.GongDanZhuanTaiID,
                                 dtGonDan.GongDanBianHao,
                                 GongDanRiQi1 = dtGonDan.GongDanRiQi,
                                 dtKeHu.KeHuXingMing,
                                 dtKeHu.YiDongShouJi,
                                 dtKeHu.TongXunDiZhi,
                                 dtPinPai.PinPaiMingCheng,
                                 dtGonDan.SongXiuLeiXingID,
                                 JinEZhuangTaiID = dtJinEZhuangTai.ShuXingMingXiID,
                                 JinEZhuangTai = dtJinEZhuangTai.ShuXingMingXiMingCheng,
                                 GongDanZhuangTai = dtGongDanZhuangTai.ShuXingMingXiMingCheng,
                                 dtGonDan.FenYongJinE,
                                 GongDanLeiXing = dtGongDanLeiXing.ShuXingMingXiMingCheng,
                                 LuRuRen = dtJieShouYuan.YuanGongXingMing,
                                 dtGonDan.ZhongBiaoQiTaoMiaoShu,
                                 dtGonDan.XiuPeiJiLu,
                                 dtGonDan.WaiGuan,
                                 dtGonDan.KeHuZhiShu,
                                 dtGonDan.BiaoKuan,
                                 dtGonDan.BiaoDaiJieShu,
                                 dtGonDan.BiaoXingHao,
                                 dtGonDan.BiaoShenHao,
                                 dtGonDan.ZhongBiaoLeiXing,
                                 dtGonDan.JiXinXingHao,
                                 dtGonDan.GuiGe,
                                 SongXiuRiQi1 = dtGonDan.SongXiuRiQi,
                                 YuFangRiQi1 = dtGonDan.YuFangRiQi,
                                 dtGonDan.YuanShiDanHaoID,
                                 YuanShiGongDan = dtYuanShiDanHao != null ? dtYuanShiDanHao.GongDanBianHao : "无原始工单",
                                 WeiXiuShiFuID = dtGongDanPaiGong.WeiXiuShiFuID != null ? dtGongDanPaiGong.WeiXiuShiFuID : null,
                                 WeiXiuShiFu = dtWeiXiuShiFu.YuanGongXingMing
                             };
            #endregion
            #region 转换数据
            List<Dictionary<string, object>> myList = new List<Dictionary<string, object>>();
            foreach (var varRow in varGongDan)
            {
                Dictionary<string, object> myDic = new Dictionary<string, object>();
                foreach (System.Reflection.PropertyInfo p in varRow.GetType().GetProperties())
                {
                    myDic.Add(p.Name, p.GetValue(varRow, null));
                }
                myDic.Add("GongDanRiQi", varRow.GongDanRiQi1.Value.ToString("yyyy-MM-dd"));
                myDic.Add("SongXiuRiQi", varRow.SongXiuRiQi1.Value.ToString("yyyy-MM-dd"));
                myDic.Add("YuFangRiQi", varRow.YuFangRiQi1.Value.ToString("yyyy-MM-dd"));
                myList.Add(myDic);
            }
            #endregion
            return Json(myList, JsonRequestBehavior.AllowGet);
        }
        #endregion

界面表格html代码:

<table id="dgvGongDan" class="easyui-datagrid" style="width: auto; height: auto"
    data-options="
    singleSelect:true,
    collapsible:true,            
    onClickRow:ClickRow,
    onClickCell:QuXiaoWeiXiuShiFu,
    rowStyler: function(index,row){
			if (row.XiuGaiJuLu == 1){
				return 'background-color:#39ae78;color:#fff;';
			}
		},footer:'#_Paging'">
    <thead>
        <tr>
            <th data-options="field:'order',width:'auto',align:'center'"></th>
            <th data-options="field:'WeiXiuShiFu',width:100,formatter:myformatter">
                维修师傅
            </th>
            <th data-options="field:'XiuGaiJuLu',width:100,align:'center',hidden:true">
                修改记录
            </th>
            <th data-options="field:'WeiXiuShiFuID',width:90,align:'center',hidden:true">
                维修师傅ID
            </th>
            <th data-options="field:'GongDanLuRuID',width:90,align:'center',hidden:true">
                工单录入ID
            </th>
            <th data-options="field:'GongDanLeiXingID',width:90,align:'center',hidden:true">
                工单类型ID
            </th>
            <th data-options="field:'KeHuID',width:90,align:'center',hidden:true">
                客户ID
            </th>
            <th data-options="field:'PinPaiID',width:90,align:'center',hidden:true">
                品牌ID
            </th>
            <th data-options="field:'JieShouYuanID',width:90,align:'center',hidden:true">
                接收员ID
            </th>
            <th data-options="field:'WeiXiuLeiXingID',width:90,align:'center',hidden:true">
                维修类型ID
            </th>
            <th data-options="field:'GongDanZhuanTaiID',width:90,align:'center',hidden:true">
                工单状态ID
            </th>
            <th data-options="field:'JinEZhuangTaiID',width:90,hidden:true">
                金额状态ID
            </th>                    
            <th data-options="field:'GongDanBianHao',width:160,align:'center'">
                工单编码
            </th>
            <th data-options="field:'GongDanRiQi',width:'auto',align:'center'">
                工单日期
            </th>
            <th data-options="field:'KeHuXingMing',width:'auto',align:'center'">
                客户姓名
            </th>
            <th data-options="field:'YiDongShouJi',width:'auto',align:'center',hidden:true">
                移动手机
            </th>
            <th data-options="field:'PinPaiMingCheng',width:90,align:'center'">
                品牌
            </th>
            <th data-options="field:'GongDanZhuangTai',width:120,align:'center'">
                工单状态
            </th>
            <th data-options="field:'JinEZhuangTai',width:'auto',align:'center'">
                金额状态
            </th>
            <th data-options="field:'FenYongJinE',width:'auto',align:'center'">
                费用金额
            </th>
            <th data-options="field:'GongDanLeiXing',width:'auto',align:'center'">
                工单类型
            </th>
            <th data-options="field:'LuRuRen',width:'auto',align:'center'">
                录入员
            </th>
                <th data-options="field:'SuoShuMenDian',width:'auto',align:'center'">
                所属门店
            </th>
            <th data-options="field:'ZhongBiaoQiTaoMiaoShu',width:100,align:'center',hidden:true">
                钟表其他描述
            </th>
            <th data-options="field:'XiuPeiJiLu',width:120,align:'center',hidden:true">
                修配记录
            </th>
            <th data-options="field:'WaiGuan',width:90,align:'center',hidden:true">
                外观
            </th>
            <th data-options="field:'KeHuZhiShu',width:90,align:'center',hidden:true">
                客户自述
            </th>
            <th data-options="field:'ZhongBiaoLeiXing',width:'auto',align:'center',hidden:true">
                钟表类型
            </th>
            <th data-options="field:'BiaoKuan',width:'auto',align:'center'">
                表款
            </th>
            <th data-options="field:'BiaoDaiJieShu',width:'auto',align:'center',hidden:true">
                表带节数
            </th>
            <th data-options="field:'BiaoShenHao',width:'auto',align:'center',hidden:true">
                表身号
            </th>
            <th data-options="field:'BiaoXingHao',width:'auto',align:'center',hidden:true">
                表型号
            </th>
            <th data-options="field:'TongXunDiZhi',width:200,align:'center',hidden:true">
                客户地址
            </th>
            <th data-options="field:'ZhongBiaoLeiXing',width:'auto',align:'center',hidden:true">
                钟表类型
            </th>
            <th data-options="field:'JiXinXingHao',width:'auto',align:'center',hidden:true">
                机芯型号
            </th>
            <th data-options="field:'GuiGe',width:150,align:'center',hidden:true">
                规格
            </th>
            <th data-options="field:'SongXiuRiQi',width:'auto',align:'center',hidden:true">
                送修日期
            </th>
            <th data-options="field:'YuFangRiQi',width:'auto',align:'center',hidden:true">
                预返日期
            </th>
            <th data-options="field:'YuanShiDanHaoID',width:'auto',align:'center',hidden:true">
                原始单号ID
            </th>
            <th data-options="field:'YuanShiGongDan',width:'auto',align:'center',hidden:true">
                原始工单
            </th>
            <th data-options="field:'CaoZuo',width:110,align:'center',formatter:CaoZuo">
                操作
            </th>
        </tr>
    </thead>
</table>

jQuery代码:

生成代码:

function myformatter(value, index) {
        if (value) {
            return '<a href="javascript:;"  onclick="OpenWeiXiuShiFu(event)"><img src="../../Content/UI/themes/icons/mini_edit.png" />'+ value + '</a>';
        }
        else {
            return '<a href="javascript:;"  onclick="OpenWeiXiuShiFu(event)"><img src="../../Content/UI/themes/icons/man.png" />选师傅</a>';
        }
    }<strong>
</strong>

点击选择维修师傅的代码:

function OpenWeiXiuShiFu(event, index) {
        $('#frmWeiXiiuShiFu').reveal($(this).data());//打开维修师傅的窗体
    } 

双击选择维修师傅

代码:

//选择维修师傅
    function XuanZheWeiXiuShiFu() {
        var GongDanRow = $('#dgvGongDan').datagrid("getSelected"); //1、获取要修改的行
        if (GongDanRow.GongDanZhuanTaiID == 67 || GongDanRow.GongDanZhuanTaiID == 76 || GongDanRow.GongDanZhuanTaiID == 77 || GongDanRow.GongDanZhuanTaiID == 80 || GongDanRow.GongDanZhuanTaiID == 83) {
            alert("当前单据不支持派工");
            $('#frmWeiXiiuShiFu').css('visibility', 'hidden');
            $('.reveal-modal-bg').css('display', 'none');
            return;
        }
        if (ServiceMasetrID == GongDanRow.WeiXiuShiFuID) {
            alert("当前师傅已是所选师傅"); return;
        }
        if (ServiceMasetrID>0 && GongDanRow) {
            $('#frmWeiXiiuShiFu').css('visibility', 'hidden');//关闭窗体
            $('.reveal-modal-bg').css('display', 'none');
            GongDanRow.WeiXiuShiFu = ServiceMasetrText; //2、给要修改的字段赋值
            GongDanRow.WeiXiuShiFuID = ServiceMasetrID;
            GongDanRow.XiuGaiJuLu = 1;
            GongDanRow.CaoZuo = 1;
            $('#dgvGongDan').datagrid('refreshRow', editIndex); //3、刷新行
        }
    }<strong>
</strong>

点击(查询派工记录或取消选择)

派工记录弹窗效果图:


2.2.4 (图8)

代码:

//取消选择维修师傅或查看派工记录   
    function QuXiaoWeiXiuShiFu(rowIndex, field, value) {       
        if (field == "CaoZuo") {//判断是否点击操作这一列
            if (value == 1) {//判断按钮是否为取消选择
                var GongDanRow = $('#dgvGongDan').datagrid("getData").rows[rowIndex]; //1、获取要修改的行
                if (GongDanRow) {
                    $.getJSON("/WeiXiuGuanLi/ShuaXinHangGongDan?intGongDanLuRuID=" + GongDanRow.GongDanLuRuID,
                function (Dt) {
                    GongDanRow.WeiXiuShiFu = Dt[0].WeiXiuShiFu; //2、给要修改的字段赋值
                    GongDanRow.WeiXiuShiFuID = Dt[0].WeiXiuShiFuID;
                    GongDanRow.XiuGaiJuLu = "";
                    GongDanRow.CaoZuo = "";
                    $('#dgvGongDan').datagrid('refreshRow', rowIndex); //3、刷新行          
                });
                }
            }
            else {//查看派工记录
                $('#dgvPaiGongJiLu').datagrid("loadData", { total: 0, rows: {} });//清空表格
                if ($('#dgvGongDan').datagrid("getData").rows[rowIndex]) {
                    $('#lblGongDanBianHao').html($('#dgvGongDan').datagrid("getData").rows[rowIndex].GongDanBianHao);
                    $('#lblKeHuXingMing').html($('#dgvGongDan').datagrid("getData").rows[rowIndex].KeHuXingMing);
                    $('#lblLianXiDianHua').html($('#dgvGongDan').datagrid("getData").rows[rowIndex].YiDongShouJi);
                    $.getJSON("/WeiXiuGuanLi/SelectPaiGong?intGongDanID=" + $('#dgvGongDan').datagrid("getData").rows[rowIndex].GongDanLuRuID,
                function (DtPaiGongJiLu) {
                    if (DtPaiGongJiLu.length == 0) { alert("当前单据没有派工记录"); return; }
                    $('#dgvPaiGongJiLu').datagrid("loadData", DtPaiGongJiLu);
                    $('#frmPaiGongJiLu').reveal($(this).data());//打开派工记录窗体
                });
                }
                else {   }
            }
        }
        $('#dgvGongDan').datagrid('refreshRow', rowIndex); //3、刷新行   
    }<span style="font-size:18px;"><strong>
</strong></span>
点击按钮的代码:
//保存派工
    function BaoCunPaiGongShiFu() {
        var varBol = 0;
        var varChengGongShu = 0;
        //第一个循环判断有没有选择维修师傅
        for (var R = 0; R < $('#dgvGongDan').datagrid("getData").rows.length; R++) {
            if ($('#dgvGongDan').datagrid("getData").rows[R].XiuGaiJuLu == 1) {
                varBol++;
            }
        }
        if (varBol > 0) {
            //第二个循环保修所选择的维修师傅
            for (var varR = 0; varR < $('#dgvGongDan').datagrid("getData").rows.length; varR++) {
                if ($('#dgvGongDan').datagrid("getData").rows[varR].XiuGaiJuLu == 1) {//判断是否有选择维修师傅
                    $.getJSON("/WeiXiuGuanLi/BaoCunPaiGong?intGongDanID=" + $('#dgvGongDan').datagrid("getData").rows[varR].GongDanLuRuID
                                + "&" + "intWeiXiuShiFuID=" + $('#dgvGongDan').datagrid("getData").rows[varR].WeiXiuShiFuID
                                + "&" + "intCaoZuoYuanID=" + parent.ParentID,
                                function (tr) {
                                    if (tr == true) {
                                        varChengGongShu++;
                                        if (varChengGongShu == varBol) {
                                            alert("保存成功");
                                            SelectGongDan();
                                        }
                                    }
                               });
                }
            }
        }
        else {
            alert("请为您要派工的单据选择维修师傅");
        }
    }<span style="font-size:18px;"><strong>
</strong></span>


以上内容仅供学习,禁止用于商业用途





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值